Tuesday, September 19, 2006

Test syntax of shell script

The shell has a number of flags that make debugging easier:

sh -n command

Read the shell script but don't execute the commands, i.e., check syntax.

sh -x command

Display commands and arguments as they're executed. In a lot of my shell scripts you'll see

# Uncomment the next line for testing
# set -x

0 Comments:

Post a Comment

<< Home