Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm From: hansm@cs.kun.nl (Hans Mulder) Newsgroups: comp.unix.shell Subject: Re: Finding the last arg Keywords: Bourne shell arguments Message-ID: <2577@wn1.sci.kun.nl> Date: 3 Jan 91 21:47:45 GMT References: <18476@shlump.nac.dec.com> <3074@wyse.wyse.com> <1991Jan2.174157.21530@usenet.ins.cwru.edu> Sender: root@sci.kun.nl Organization: University of Nijmegen, The Netherlands Lines: 27 In article <1991Jan2.174157.21530@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes: >Here's a short list of what was added to the v7 sh for the System V.2 sh: [ stuff deleted ] >exit status of a pipeline was defined to be the exit status of the last command Nit-pick: Both the v7 and the SVR2 sh manuals mention that "the exit status of a pipeline is the exit status of the last command". The problem is the the word "last" is ambiguous. The v7 sh takes it to mean "last to terminate", SVR2 interprets it as "rightmost". Thus the pipeline "sleep 10 | false" would be considered successful by the v7 shell (since the sleep terminates last, and successfully), while the SVR2 sh considers it unsuccessful. I think the latter behaviour is more useful. For one thing, it makes "if foo | grep -s bar" work right 100% of the time. Happy New Year, Hans Mulder hansm@cs.kun.nl