Debugging usigh bashdb

suggest change

Bashdb is a utility that is similar to gdb, in that you can do things like set breakpoints at a line or at a function, print content of variables, you can restart script execution and more.

You can normally install it via your package manager, for example on Fedora:

sudo dnf install bashdb

Or get it from the homepage. Then you can run it with your script as a paramater:

bashdb <YOUR SCRIPT>

Here are a few commands to get you started:

l - show local lines, press l again to scroll down
s - step to next line 
print $VAR - echo out content of variable 
restart - reruns bashscript, it re-loads it prior to execution.
eval - evaluate some custom command, ex: eval echo hi

b <line num> set breakpoint on some line 
c - continue till some breakpoint 
i b - info on break points 
d <line #> - delete breakpoint at line #

shell - launch a sub-shell in the middle of execution, this is handy for manipulating variables

For more information, I recommend consulting the manual:

See also homepage:

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents