On 10/10/12 10:38 AM, Wladimir Sidorenko wrote: > 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.
The current behavior is the intended behavior. PIPESTATUS reflects the "true" return status(es) of the process(es) in the pipeline, before any inversion of the pipeline's exit status. That's what seems the most useful. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/