Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a shell script invoked with "exec"?

Suppose I've got a bash script foo.bash, which uses exec to run another bash script:

exec bar.bash

Now am debugging both foo.bash and bar.bash. I am running foo.bash with bash -x but it does not run bar.bash in debug mode. What should I do to run bar.bash in debug mode too ?

like image 208
Michael Avatar asked Mar 02 '26 00:03

Michael


1 Answers

You can also export SHELLOPTS from foo.bash as well to export the shell options.

export SHELLOPTS
like image 109
P.P Avatar answered Mar 04 '26 14:03

P.P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!