Paul Jarc wrote:
Linda Walsh <[EMAIL PROTECTED]> 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