Reputation: 63062
I am trying to trace/debug a shell script that in turn includes nested invocations to other shell scripts.
My approach has been:
The second approach does end up showing the executions by the shell for the main script. But the nested scripts seem not to inherit that setting - either from the "set -x" on bash prompt or from the calling shell script.
Any way to achieve the inherited behavior - short of modifying each and every nested script?
Upvotes: 12
Views: 2870
Reputation: 34003
You can use the SHELLOPTS
environment variable to make the "sub" shell use the same options. You just have to export it before any calls to subshells:
export SHELLOPTS
Upvotes: 18