To debug a shell script,
sh -n scriptfile.sh
will check for (most) syntax errors without actually executing the script, while
sh -v scriptfile.sh
will echo each command before executing it. Use them together:
sh -nv scriptfile.sh
to get a verbose syntax check.
http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/debugging.html
Leave a Reply