Shell

How do you debug shell scripts?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Answer depends on the language you are using for writing your scripts. If Bash is used for example then:

  • Adding -x to the script I'm running in Bash
  • Old good way of adding echo statements

If Python, then using pdb is very useful.