8
How can I Debug bash Scripts? No OF I can use @echo ON and @echo OFF. I would like to use something analogous on Linux.
8
How can I Debug bash Scripts? No OF I can use @echo ON and @echo OFF. I would like to use something analogous on Linux.
10
Use the following:
sh -x script [arg1 ...]
bash -x script [arg1 ...]
This allows to make a trace of what is being executed.
Another useful option is -n which means in Execution and -v which means verbose mode. It is useful to combine these parameters to further facilitate your bash shell DEBUG when you invoke by the prompt.
If you wish to control the trace from within Script in specific blocks of code use:
set -x
for connect the trace. To turn off the trace use:
set +x
Browser other questions tagged linux shell bash debug
You are not signed in. Login or sign up in order to post.
@bmkrio, What can also help is the option
set -v / +v
, it displays the code before running without parse (original code).– ceinmart
A good help in debugging is using shellcheck.
– gorn