bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exit application with two function calls


From: Linda Walsh
Subject: Re: Exit application with two function calls
Date: Tue, 29 Jan 2008 10:10:00 -0800
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Paul Jarc wrote:
Linda Walsh <address@hidden> wrote:
# *1 - using "-e" stops your script immediately on any error

Not any error - only those from simple commands.  The subtleties are
subtle enough that I avoid -e, and use "&&" between all commands
instead.

paul
----
Yeah...it doesn't catch everything -- probably not best for a
production script, but I always use it as "-ue".  That catches
many more -- mispelled or unset vars also cause an errexit.

It depends on how you program -- if you use && and || alot, it
will "hide" a failure status, but presumably, if you are using
|| or ||, you are catching the error condition yourself...?

I'll often use (cd dir && do-something-I-only-want-done-in-dir)....

Using a pathological example:
cd /temp; rm -fr *   # not likely intended if one meant
                     # /tmp instead of /temp... :-),
but
    cd /tmp && rm -fr *
is slightly safer...

I thought && and || were specifically listed as ways to
avoid a command failure (so -e wouldn't trigger an exit)...
Maybe that was in some other shell reference I read.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]