Quantcast
Channel: bourne shell
Viewing all articles
Browse latest Browse all 7

Debug Linux shell scripts with ‘-x’

$
0
0
Debug Linux shell scripts with ‘-x’ alvin December 17, 2011 - 12:30pm

If you ever need to debug a Unix or Linux shell script, you can just add the -x option to the interpreter when you invoke it. You can add the shell's debug option on the command line like this:

sh -x misbehaving_script.sh

or at the end of the first line in your shell script (the she-bang line), like this:

#!/bin/sh -x

I was just working on a shell script related to fonts on a Mac OS X (Unix), system, and when I tried to run it normally, all it gave me was this error message:


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images