Discussion:
[Help-bash] Is there a way to automatically trace errors?
Peng Yu
2018-04-21 11:52:06 UTC
Permalink
Hi, I have a large number of scripts that calls themselves. Here is
just a toy example.

==> script2.sh <==
#!/usr/bin/env bash
xxx
==> script1.sh <==
#!/usr/bin/env bash
./script2.sh
==> main.sh <==
#!/usr/bin/env bash
./script1.sh

When I run main.sh, I only get the error at the last step. But it
would be helpful to show the intermediate file script1.sh for easy
tracing. I don't want to make any changes in script1.sh (as in a real
case, the scripts may not be changeable.)

Is there an easy way to show the trace information? Thanks.

$ ./main.sh
./script2.sh: line 4: xxx: command not found
--
Regards,
Peng
Loading...