1. Shell Script debugging
Use the SH command to check the syntax of the shell and trace the execution steps. SH [-NVX] script.sh-n: Do not execute script, only check for syntax problem-V: Print script before execution-x: Print script to use
2. Check for syntax errors
Using Sh-n, if there is a syntax error, it will be prompted.
3. Shell Debug Print
[[email protected] sh]$ sh-v for.sh #!/bin/bash# desc:for loopfor animal in dog cat pig does echo "HI, ${animal}" done HI, Doghi, Cathi, Pigexit; [Email protected] sh]$
[[email protected] sh]$ sh-x for.sh + for animal in dog cat pig+ echo ' Hi, dog ' Hi, dog+ for animal in dog cat pig+ Echo ' Hi, Cat ' Hi, cat+ for animal in dog cat pig+ echo ' Hi, pig ' Hi, pig+ exit[[email protected] sh]$
Address: http://blog.csdn.net/yonggang7/article/details/40680369
Shell script tracking and debugging