[ale] bash question
David Corbin
dcorbin at machturtle.com
Sun Mar 26 15:39:11 EST 2006
On Sunday 26 March 2006 03:02 pm, Alexander Barton wrote:
> David Corbin wrote:
> > I right my share of shell scripts, and I know how to check for the status
> > of one command and terminate the script.
> >
> > I was wondering if there is a an option to bash to have it quit the
> > script automatically when a command returns a non-zero status. It would
> > make some scripts much cleaner.
>
> You want in your script something like
>
> #!/bin/bash -e
>
> or
>
> #!/bin/bash
> set -e
>
> If I remember correctly, -e causes the script to exit with non-zero
> status as soon as a command returns non-zero. There are some
> exceptions, like when the command is in a conditional expression. Read
> the bash man page for sure. Also, there are a few gotchas, like when
> grep returns non-zero on error, but also when no matching lines are found.
Thank you. I figured there had to be something...
More information about the Ale
mailing list