Sunday, June 29, 2008

Better Error Reporting in Shell Scripts

In the spirit of Perl Best Practices, here's improved error-reporting functions for shell scripts:
warn() { printf "$* at line %s file %s\n" $(caller) 1>&2 ; }
die() { warn $*; exit -1;}

No comments: