Email List: Xaustin-group-lX
[All Lists]

Re: shell option "set -e", subshells and conditionals

To: austin-group-l@xxxxxxxxxxxxx
Subject: Re: shell option "set -e", subshells and conditionals
From: "Joseph S. Myers" <jsm@xxxxxxxxxxxxxxxx>
Date: Tue, 20 May 2008 15:58:34 +0000 (UTC)
References: <cf202c2f0805200811v7e02cfc3j8c1e5126a80a5e6c@mail.gmail.com>
On Tue, 20 May 2008, Valentin Hilbig wrote:

> In short:  This is a question about an ambiuous paragraph in the POSIX
> standard about how shells handle "set -e".  My interpretation is, that
> modern POSIX conforming shells do follow a wrong path due to this.

First, I refer people to my previous interpretation request on the 
subject, PASC Interpretation Request 1003.2-92 #176.  It did not receive 
an official response before the old standard was obsoleted and I haven't 
got round to resubmitting it against the current draft.

Andrew Josey once forwarded the last comment on that request to this list, 
and it was available from

http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=2837

but that now just shows

Email archive for list austin-group-l, item 2837 archc L C austin-group-l 
2837

Date: Fri, 2 Mar 2001 09:06:33 GMT From: Andrew Josey 
<ajosey@rdg.opengroup.org> To: austin-group-l@opengroup.org Subject: (Fwd) 
proposed resolution: 1003.2 #176 Content-Type: text/plain; 
charset=us-ascii Error: 255

and perhaps he can resend the message or give a URL that will retrieve it 
from the archives again.

I have since observed that there are more problem cases than given in my 
interpretation request, where my suggested changes would not be adequate 
to reflect existing practice.  One observation is that failure of a 
pipeline causes the shell to exit only if the last command in the pipeline 
is a simple command, so "true | false" exits but "true | (false)" does 
not.  Another observation about some cases discussed in my interpretation 
request is that AND and OR lists cause the shell to exit iff the last 
command in the AND or OR list is executed and fails (and is a pipeline 
ending with a simple command); "false || true" doesn't exit, "false || 
false" does, "false && false" does not exit, "true && false" does exit.

-- 
Joseph S. Myers
jsm@polyomino.org.uk

<Prev in Thread] Current Thread [Next in Thread>