Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!uwvax!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: What's the return status of a pipeline??? Keywords: lpr,pipe,filter,status Message-ID: <17442@mimsy.UUCP> Date: 11 May 89 11:25:47 GMT References: <186@marvin.moncam.co.uk> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 30 (The exit status of a pipeline is supposed to be the exit status of the last process in the pipeline. 4BSD sh does not always get this right.) In article <186@marvin.moncam.co.uk> harry@moncam.co.uk (Jangling Neck Nipper) writes: [csh script; all but the important part deleted] >onintr quit >$BIN/psfilter -b $* | $BIN/lwriter -pI "$LWRITER" $* >>& $acct >quit: >set printer_status = $status This will always set printer_status to 0. Let us hear it for csh `design': the label `quit' succeeds, wiping out the exit status from the pipeline above. See: % (exit 1) % echo $status 1 % (exit 1) % foo: % echo $status 0 % Moral: never try to use csh for shell scripts. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris