Thursday, August 11, 2005

Handy bash debugging trick

I've long been aware of

set -x

to cause bash to show what it's doing during script execution, however when debugging a long script (hundreds of lines) this may not be enough. If you additionally
export PS4='$LINENO '

, you'll get line number information as well.