How to see what’s going in background when we run a .sh file in Linux? [closed] Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to see what’s going in background when we run a .sh file in Linux? [closed] without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I know one way i.e. ./filename.sh > log.txt. But that log file is containing the content what appears in console if we run the file using ./filename.sh.

Background process is not appearing in log file. By “background process” I mean how compiler is evaluating each and every line (the word “debug” suits that, I guess).

How to get that background process into a log file?

Answer

Based on your comment:

I mean I would like to know ‘How bash is executing each and every line of shell script’ when running a .sh file..

If you are using bash, then what you’re looking for is:

bash -x ./filename.sh

or

bash -x ./filename.sh > log.txt

Alternatively you can add:

set -x

to the content of filename.sh.

We are here to answer your question about How to see what’s going in background when we run a .sh file in Linux? [closed] - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji