Thursday, 19 December 2013

How can shell scripts be debugged in unix?

How can shell scripts be debugged in unix?

      A user when programming in shell may face an error. The user can make use of the -v and -x option with sh or bash command to debug the shell script. The syntax format of using the option is :
sh option {shell-script-name} or
bash option {shell-script-name}

     The option in the above syntax can be either -v or -x. The -v option prints the shell input lines as they are read. The -x option on the other hand expands a simple command and along with it displays the value of the ps4 variable followed by the command. It also shows the complete list of expanded arguments.

No comments:

Post a Comment