sh differences: v7 vs. SVr2
    Darin McGrew 
    mcgrew at ichthous.Eng.Sun.COM
       
    Fri Jan  4 11:36:15 AEST 1991
    
    
  
In article <2577 at wn1.sci.kun.nl> hansm at cs.kun.nl (Hans Mulder) writes:
>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".
An interesting glitch I ran into with a sh from a BSD port
(running SunOS 4.1, it works as expected).  The script
	(sleep 5; false)&
	if (sleep 10)
	then echo true
	else echo false
	fi
would echo "false" because the exit status from the backgrounded
subshell would clobber the exit status of other subshell.  This
caused all manner of havoc in a script that forked several
background shells, and figuring out what was going wrong was a
lot of fun.
Darin McGrew			mcgrew at Eng.Sun.COM
Affiliation stated for identification purposes only.
    
    
More information about the Comp.unix.shell
mailing list