tech-userlevel@netbsd.org
[Top] [All Lists]

Re: rc.d/rndctl

Subject: Re: rc.d/rndctl
From: Luke Mewburn
Date: Sat, 20 Sep 2008 09:50:58 +1000
On Fri, Sep 19, 2008 at 06:16:46PM +0400, Denis Lagno wrote:
>> in sh(1) because the code in `...' may or may not be executed
>> in a subshell depending upon the shell's implementation,
>> and therefore can't modify the state (including variables)
>> of the current shell.
>
> Looks like POSIX prescribes execution of $(...) and `...` in a subshell:
>
> # The shell shall expand the command substitution by executing command  
> in a subshell environment

My example may not have been clear enough;
with my use of   `...'  (backtick ellipsis quote)
I wasn't referring to the backtick (`) operator,
but the pseudo-code in the middle of a while loop
that is receiving input from a pipe.

For clarity, I should have written the example as
        somecommand \
        | while read foo; do
                # use $foo, which may or may not be in a sub-shell
        done

cheers,
Luke.
<Prev in Thread] Current Thread [Next in Thread>