Search code examples
linuxbashtrace

Show call stack in Bash


To start with, I do not know if this is something trivial and common knowledge; I don't know, so am asking here.

I am running a 3rd party app and trying to nail down a problem for which I need to find out the call stack.

When I call a Bash script, it calls a number of other scripts and binaries, processing stuff and exits.

What I need is a way of finding out exactly which scripts and binaries it called. pstree shows a stack but only for a process that is currently executing.


Solution

  • Run the script with bash -x, which will produce output on standard error to show each command that is executed.