Re: set -e (was: parallel build failure with .c.o rule interrupted mid-step!)
Robert Elz <[email protected]> Fri, 07 Mar 2025 06:46:03 +0700
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
Date: Thu, 6 Mar 2025 11:34:29 +0100
From: Edgar =?iso-8859-1?B?RnXf?= <[email protected]>
Message-ID: <[email protected]>
| I find it quite useful outside of make (in cases I either forget adding
| || errror "blah" in some places or it's too clumsy).
If your code is very boring (just a list of commands to run) then
it would work as expected (except I find I need to add "||:" at the
end of every command where failure is irrelevant (like echo/printf etc).
But if the code has anything more complex (functions, conditionals, ...)
even many shell experts can't easily tell what -e will, or won't do.
It really isn't wise to rely upon it, just write the code to test for
errors when that is needed.
People who don't get the results they expect when using -e contribute
one of the more common complaints about just about any shell.
kre