[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $? in the right side of a pipe
From: |
dnade.ext |
Subject: |
Re: $? in the right side of a pipe |
Date: |
Mon, 27 Dec 2010 12:58:37 +0100 |
Hello
More information on that topic :
false ; false | echo $? stills prints 0.
false ; (false) | echo $? prints 1
So.. ? $? in the right side of a pipe is randomly the exit status of the left
side depending of the way you write it ? Doesn’t sound sane.
Doesn’t that break POSIX anyway ?
I think it should be fixed.
D
On Mon, 06 Sep 2010 19:47:20 -0400, Chet Ramey wrote :
> On 9/5/10 5:36 AM, Pierre Gaston wrote:
> > using the following:
> >
> > false; : | echo $?
> >
> > bash and ksh93 print 0
> > pdksh, dash and zsh print 1
>
> It looks like bash and ksh93 wait for each command in a pipeline to finish
> and allow the intermediate commands to set $?, which, depending on timing,
> can be seen by subsequent commands in the pipeline. The other shells must
> do something different.
--
Damien Nadé <dnade.ext@orange-ftgroup.com>
Astek Sud-Est pour France Télécom - FT/TGPF/OPF/PORTAIL/DOP/DEV/EAQS
Sophia Antipolis - France / Tel : 04 97 12 86 20
*********************************
This message and any attachments (the "message") are confidential and intended
solely for the addressees.
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration.
France Telecom Group shall not be liable for the message if altered, changed or
falsified.
If you are not the intended addressee of this message, please cancel it
immediately and inform the sender.
********************************