Subject: Re: Bourne shell oddity
To: None <current-users@netbsd.org>
From: Martin Ammermueller <martin.ammermueller@bnro.de>
List: current-users
Date: 06/22/2005 10:47:23
Havard Eidnes wrote on 2005-06-21|16:35:
> -------------------- /tmp/x:
> #! /bin/sh
>
> echo x: before
> ( sh -c "sleep 60" ) > /dev/null 2>&1 </dev/null &
> echo x: after
> exit 0
> -------------------- /tmp/y:
> #! /bin/sh
>
> echo y: before
>
> l=`/tmp/x`
>
> echo y: after
> --------------------
>
> If you run "sh /tmp/y", the "y: after" output will not appear
> until 60 seconds has passed, i.e. the innermost background job
> finishes, even though that job has no chance of affecting the
> result due to the redirection.
I don't think that's a bug. According to the sh(1) manpage, the
backquotes will be replaced by the output of the enclosed command.
But how can you get the complete output of the enclosed command
before it has finished?
Martin
--
Jabber-ID: tenco@jabber.ccc.de
http://www.jabber.org
An Anarchist FAQ Webpage:
http://www.anarchismfaq.org