🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #43

Pipeline synchronization - sh vs ksh

#43
From: Tom Neff
Date: Fri, 04 Aug 1989 15:48
27 lines
1709 bytes
I don't know if the following is a bug or a feature, but it exists. I had
a complex backup script which I was running under the Bourne shell.  The
business end of it ended up evaluating to something like

	find / -print | fgrep -v /tmp/ | fgrep -v /spool/ | \
		pax -wv | compress | team 32k 4 > /dev/rmt/c0s0

so there were about 6 processes in a pipeline.  That 'team' (it's a
buffering copy for tape streaming which has been posted in
comp.sources.misc, and I recommend it highly) itself creates 3 more
processes, so you might say there were 9, but only 6 created by the
shell itself.

Anyway the problem is that control returns to the shell when 'find' is
done but BEFORE the later stages of the pipeline are done!  In particular
the 'pax' and 'compress' and 'team' guys keep going.  I could not find an
effective way to synchronize the shell with the pipeline.

However when I switched to Korn shell, which we also own (I just don't
normally use it for system scripts), lo and behold the shell waits for
ALL the pipeline processes to complete before continuing the script.
So, I am happy for now, but I don't understand what was happening with
/bin/sh.  Can anyone shed some light?

-- 
"We walked on the moon --	((	Tom Neff
	you be polite"		 )) 	tneff@bfmny0.UU.NET
Technical Details
Message-ID: <14511@bfmny0.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!bfmny0!tneff

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!bfmny0!tneff
From: tneff@bfmny0.UUCP (Tom Neff)
Newsgroups: comp.bugs.sys5,comp.sys.att,comp.unix.i386
Subject: Pipeline synchronization - sh vs ksh
Message-ID: <14511@bfmny0.UUCP>
Date: 4 Aug 89 15:48:58 GMT
Reply-To: tneff@bfmny0.UUCP (Tom Neff)
Followup-To: comp.bugs.sys5
Distribution: na
Organization: ^
Lines: 27