Return values in pipelines

ilan343 at violet.berkeley.edu ilan343 at violet.berkeley.edu
Thu Aug 23 07:10:57 AEST 1990


 The /bin/sh (and the ksh) set the parameter ? to the return value of
 the last excuted command.  When I use a number of piped commands, say

prog1 | prog2 | prog3  ,

$? is set to the return value of the last command in the pipeline
(prog3) .  How can I detect if something went wrong on the previous
commands in the pipeline (prog2, prog3)?

Geraldo Veiga



More information about the Comp.unix.questions mailing list