When I want to know that process has been spawned by bash, I just check ps. But I was wondering, sometimes I launch things as

for x in $(somecomplextask.sh); do foo $x; done

I wonder, is it possible to check somewhere for the complete line with the for loop. I have the file descriptor in /proc/.../fd/0, but I do not know if I can use some tool to examine it, or perhaps even the content is not anymore, as bash has already read the line. And it is not written in bash_history yet.

Still, I thought it was interesting to ask.

  • I think set -x is what you are looking for
    – 4snok
    Apr 30, 2022 at 0:25
  • no, set -x is useful, but I was thinking in the case when the job is running and I want to know the full command it is executing at this point.
    – arivero
    May 1, 2022 at 18:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.