Reputation: 641
I need to check the run of a bash script, with a source call, something like:
#!/bin/bash
some code here
source script_b.sh
more code here
I run:
$bash -x script_a.sh
and I get,
+ some echo here
+ script_b.sh
+ some more echo here
But all echoes are from script_a.sh. All the code from script_b.sh is hidden, so I can not trace what is really happening.
Is there any way I can check the execution of script_b.sh within script_a.sh?
Upvotes: 5
Views: 3861
Reputation: 1937
You could try "bash -x script_b.sh" inside of the parent script.
Edit:
This worked for me. If you run the parent script with bash -x you will see everything for both. "set -x" will set the debug flag for the environment...in the script? I'm not sure, and fifo is still magic to me.
echo "start of script"
set -x
mkfifo fifo
cat /dev/null < fifo | fifo > source .bash_profile
rm fifo
echo "end of script"
Upvotes: 3