4.5 Examining the Stack Frame (‘where’, ‘frame’, ‘up’, ‘down’)

When your script has stopped, one thing you’ll probably want to know is where it stopped and some idea of how it got there.

Each time your script performs a function call (either as part of a command substitution or not), or ‘source’s a file, information about this action is saved. The call stack then is this a history of the calls that got you to the point that you are currently stopped at.

One of the stack frames is selected by the BASH debugger and many the BASH debugger commands refer implicitly to the selected frame. In particular, whenever you ask the BASH debugger to list lines without giving a line number or location the value is found in the selected frame. There are special the BASH debugger commands to select whichever frame you are interested in. See Selecting a frame.

When your program stops, BASH automatically selects the currently executing frame and describes it briefly, similar to the frame command.