bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $? in the right side of a pipe


From: Greg Wooledge
Subject: Re: $? in the right side of a pipe
Date: Tue, 7 Sep 2010 08:36:16 -0400
User-agent: Mutt/1.4.2.3i

On Mon, Sep 06, 2010 at 07:47:20PM -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.

Just as another data point, ksh88 (as shipped on HP-UX 10.20 as 'ksh')
prints 0.  ('sh' does too, but 'sh' on that system is mostly ksh88 also.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]