Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging. Debug Syntax checking Shell tracing I-Enabling Debugging #!/bin/sh option.

Similar presentations


Presentation on theme: "Debugging. Debug Syntax checking Shell tracing I-Enabling Debugging #!/bin/sh option."— Presentation transcript:

1 Debugging

2 Debug Syntax checking Shell tracing

3 I-Enabling Debugging #!/bin/sh option

4 Using the set command By using the set command, you can enable and disable debugging at any point in your shell script. The basic syntax follows set option 1 #!/bin/sh 2 set -x 3 if [ -z "$1" ] ; then 4echo "ERROR: Insufficient Args." 5exit 1 6 fi

5 Disabling Debugging Using set set +option All the debugging modes that are enabled for a script can be deactivated using the following command: $ set -

6 Enabling Debugging for a Single Function set -x ; BuggyFunction; set +x ;

7 II-Syntax Checking 1 #!/bin/sh 2 3 YN=y 4 if [ $YN = "yes" ] 5 echo "yes" 6 fi $ /bin/sh -n./buggy1.sh Verbose mode –$ /bin/sh -nv./buggy1.sh

8 III-Shell Tracing set -x ; ls *.sh ; set +x Finding Syntax Bugs Using Shell Tracing Finding Logical Bugs Using Shell Tracing Using Debugging Hooks


Download ppt "Debugging. Debug Syntax checking Shell tracing I-Enabling Debugging #!/bin/sh option."

Similar presentations


Ads by Google