[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $? in the right side of a pipe
From: |
Chet Ramey |
Subject: |
Re: $? in the right side of a pipe |
Date: |
Mon, 06 Sep 2010 19:47:20 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 |
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.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/