Wladimir Sidorenko <wlsidore...@gmail.com> writes:

> Dear all,
>
> After running the following command:
>
> $  ! test 0 -eq 0
>
> I can see different exit codes in $? and ${PIPESTATUS[@]}. Here, what I get
>
> $ ! test 1 -eq 0 ; echo $? ${PIPESTATUS[@]}
> 0 1
>
> $ ! test 0 -eq 0 ; echo $? ${PIPESTATUS[@]}
> 1 0
>
> I'd like to know whether that's a desired behavior or a bug.

PIPESTATUS records the exit status of each command of a pipeline.  !
operates on the whole pipeline, not on the invidual commands.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Reply via email to