debug [script-name]
¶Debug into bash-script-name. If no name is given the current source line is used. In either case the options are prepended to cause the debugger to run.
A separate bash shell is run for debug
invocation. Therefore,
generally debugger settings, in particular those that are not
export
’ed from one session don’t bleed into the next.
One environment variable that is exported is The nesting level of the debugger,
_Dbg_DEBUGGER_LEVEL
. The debugger prompt indicates the level of nesting
by enclosing the history in that many nestings of <>
symbols.
Here is an example session of using the debug
command:
$ bashdb /etc/profile bash debugger, bashdb, ... bashdb<1> break 14 Breakpoint 1 set in file /etc/profile, line 14. bashdb<2> info break Num Type Disp Enb What 1 breakpoint keep y /etc/profile:14 bashdb<3> debug /etc/profile.d/01-locale-fix.sh Debugging new script with /bin/bash /usr/bin/bashdb -q -L /usr/share/bashdb /etc/profile.d/01-locale-fix.sh (/etc/profile.d/01-locale-fix.sh:2): 2: eval $(/usr/bin/locale-check C.UTF-8) bashdb<<0>> info break No breakpoints have been set. bashdb<<1>> x _Dbg_DEBUGGER_LEVEL declare -ix _Dbg_DEBUGGER_LEVEL="2" bashdb<<2>> quit bashdb: That's all, folks... bashdb<4> info break Num Type Disp Enb What 1 breakpoint keep y /etc/profile:14 bashdb<5> x _Dbg_DEBUGGER_LEVEL declare -ix _Dbg_DEBUGGER_LEVEL="1"