How to debug a shell script in UNIX

posted Apr 29, 2012, 8:07 AM by Sachchida Ojha   [ updated May 22, 2013, 9:11 AM ]


Using -x option to debug a shell script

Run a shell script with -x option.
$ bash -x script-name
$ bash -x dbaref.sh

Using SET
set -x : Display commands and their arguments as they are executed.
set -v : Display shell input lines as they are read.


Comments