"exec sleep 30 | sleep 30" vs. "sleep 30 | sleep 30" in sh
Arthur David Olson
ado at elsie.UUCP
Tue Sep 3 07:57:11 AEST 1985
The latest version of the news software "cunbatch" Bourne shell script I've
received has this as its last line (after installation):
exec /usr/lib/news/compress -d | /usr/local/rnews
Now my guess was that the "exec" thrown in there was designed to get rid of
a sub-shell that might wait around for "compress" to complete (after which it
would report back to the parent shell that was interpreting the script).
However, my rummaging on our 4.1bsd VAX system revealed that
whether you had a script with a last line of
exec sleep 30 | sleep 30
or a script with a last line of
sleep 30 | sleep 30
(or, for that matter, a script with
sleep 30 | exec sleep 30
or
exec sleep 30 | exec sleep 30
as the last line) you ended up with two "sleep"s and one "sh".
And so the question to folks on the net: on what system does the "exec" in the
"cunbatch" do something useful--and what useful does it do? (Side question:
is there any system on which it does harm?)
(To forestall one bogus answer: it's true that the C shell treats
sleep 30 | sleep 30
and
exec sleep 30 | sleep 30
differently. My question is whether there's any system on which "sh" treats
them differently.)
--
UNIX is an AT&T Bell Laboratories trademark.
Sleep is a Rip Van Winkle trademark.
--
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado at seismo.ARPA
DEC, VAX and Elsie are Digital Equipment and Borden trademarks
More information about the Comp.unix.wizards
mailing list