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
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?
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
bash -x ./filename.sh > log.txt
Alternatively you can add:
to the content of