Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any way to debug bash script without using echo and logging?

I'm talking about using breakpoints and stuff like that.

share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

Yes there is Bash Debugger Project.

alt text

You can also use set -x and set-v at execution. HERE and HERE or HERE is some info on that.

good luck!

share|improve this answer
add comment

There several different ways, i.e.:

  • Run your script with the -x option

    bash -x yourscript.sh
  • Add set -x in a new line at the beginning of your scriptfile after the Shebang #!/bin/bash and before the beginning of your script, set -v would display the shell input lines, set -x displays the executed commands and arguments

  • replace the shebang of your script file with #!/bin/bash -xv

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.