Is it possible to debug bash scripts line-by-line?

这一生的挚爱 提交于 2019-12-19 02:49:06

问题


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.


回答1:


See bashdb.

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

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




回答2:


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



来源:https://stackoverflow.com/questions/14889322/is-it-possible-to-debug-bash-scripts-line-by-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!