[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    Re: ksh: strange $?
From:       Philip Guenther <guenther () gmail ! com>
Date:       2009-08-22 0:01:08
Message-ID: dd0728a90908211701l7b0e2214v26353ec7dafda1da () mail ! gmail ! com
[Download RAW message or body]

On Fri, Aug 21, 2009 at 4:22 PM, Dieter
Holkenpolk<holkenpolk@googlemail.com> wrote:
> Consider the shell script:
> false
> false &
> echo $?
>
> The output is 0.  The ksh manual says $? is
> "the exit status of the last non-asynchronous command executed."
> What do you think?

Yeah, I think it should be changed to "the exit status of the last
pipeline executed".  'pipeline' instead of 'command' to
a) clarify that "true; false | echo $?" must echo 0 despite 'false'
possibly being
    considered the last command executed, and
b) mirror the wording of the standard at
   http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#ta
g_18_05_02

(The behavior complies with the standard, so it's a doc issue.  Note
that it's already stated in the "Command syntax" section that the exit
status of an asynchronous list is zero.)


Philip Guenther

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic