How can I run nested shell scripts with the same option? For example,
parent.sh
#!/bin/sh
./child.sh
child.sh
#!/bin/sh
ls
How can I change parent.shit so that when I run it with a sh -x parent.shparameter -x, it is effective both in child.shand on my console, execution is displayed ls?
I am looking for a portable solution that is effective for rare situations, such as users of the system with /bin/falsea registered shell. Will there be any help to the variable $SHELL?
Clarification: I sometimes want to call parent.shwith -x, sometimes with -e, depending on the situation. Therefore, the solution should not include hard flag coding.