[lug] How does bash "set -e" work?

Jeffrey S. Haemer jeffrey.haemer at gmail.com
Sun Dec 30 12:48:09 MST 2012


On Sun, Dec 30, 2012 at 12:00 PM, Rob Nagler <nagler at bivio.biz> wrote:

> The "||" isn't modifying stdout so how would it "know"
> except by some internal state passed in the fork.
>

Absolutely agree. Must be doing that.

*Set* and *env* track what the flag is being set to in the subshell.  Yet
something's being passed down in the environment, through the fork, from
the parent shell, that's telling the child "... but never mind about that."

$ (set -e; set -o | grep errexit; false; echo hello ) || echo goodbye
> errexit         on

hello


I could download the shell source and paw through it but -- as fun as that
sounds -- I have go meet a couple of guys to figure out what tunes we're
playing tomorrow night.

Oh ... but did I mention there's a dance you can go to in Ft.
Collins<http://www.fotd.org/annual/index.htm>,
tomorrow night? With live music?  :-)

Well, unless you'd rather stay home and read shell source code.

-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
*פרייהייט? דאס איז יאַנג דינען וואָרט.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20121230/4f01ab76/attachment.html>


More information about the LUG mailing list