Is it possible to debug bash scripts line-by-line?
Asked Answered
F

2

6

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so.

Is there any tool or way to do it? set -x and set -v are nice but not perfect.

Fathometer answered 15/2, 2013 at 6:22 Comment(4)
see https://mcmap.net/q/120257/-how-can-i-debug-a-bash-script-closedBirdhouse
Already seen. Doesn't covers line-by-line debugging, which is the whole point here. I've already searched alot and found nothing, which is why I came to SO.Fathometer
No, the set -x (and -n and -v) options are basically what's available.Newsome
The linked question also refers Bash Debugger which is what you are looking for.Shag
T
6

See bashdb.

If it's installed on your system, see man bashdb.

If it's not installed, see http://bashdb.sourceforge.net

Tl answered 22/4, 2013 at 18:29 Comment(0)
R
1

Yes. Use "bashdb" from http://bashdb.sourceforge.net/

Latest version at time of writing http://sourceforge.net/projects/bashdb/files/bashdb/4.2-0.8/

If you are on a Mac (like I was) then you might need to install the GNU version of Bash.

I did that using "MacPorts" http://www.macports.org/

Once you have MacPorts...

port install bash

Then follow the instructions to

./configure (in bashdb unpacked directory)

make

sudo make install

Then add the folder where bashdb can be found in your PATH

Rousing answered 11/1, 2014 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.