[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] bash question
- Subject: [ale] bash question
- From: esoteric at 3times25.net (Geoffrey)
- Date: Sun, 26 Mar 2006 08:22:14 -0500
- In-reply-to: <[email protected]>
- References: <[email protected]>
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.
What's wrong with something like:
command || exit 1
Or you could write yourself a shell function that's called on failure.
It would give you a single point of exit.
Other then that, I don't think there's a way to do what you want.
--
Until later, Geoffrey
Any society that would give up a little liberty to gain a little
security will deserve neither and lose both. - Benjamin Franklin