Is it possible to write a command which runs
my.sh and prints every path sourced or executed by this script recursively - That is, without altering the original code at all? The idea is to verify which files are actually used for a specific execution path, without time-consuming and error-prone manual tracing.
$ > my.sh cat <<'EOF' #!/bin/sh . ./foo.sh EOF $ > foo.sh cat <<'EOF' #!/bin/sh ./bar.sh EOF $ > bar.sh cat <<'EOF' #!/bin/sh echo bar EOF $ chmod u+x my.sh bar.sh $ magic command [...] ./my.sh ./foo.sh ./bar.sh