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

Re: rc.d/network

Subject: Re: rc.d/network
From: Christos Zoulas
Date: Fri, 19 Sep 2008 17:56:34 -0400
On Sep 20,  3:27am, kre@xxxxxxxxxxxxx (Robert Elz) wrote:
-- Subject: Re: rc.d/network

|     Date:        Fri, 19 Sep 2008 19:32:33 +0000 (UTC)
|     From:        christos@xxxxxxxxxx (Christos Zoulas)
|     Message-ID:  <gb0uoh$omi$1@xxxxxxxxxxxxx>
| 
|   | Why "eval set -- \$argslist" instead of "set -- $argslist"?
| 
| epsilon$ args="a b c;d e f"
| epsilon$ IFS=';' set -- $args
| epsilon$ echo $#
| 5
| epsilon$ IFS=';' eval set -- \$args
| epsilon$ echo $#
| 2
| 
| 
| That is, in the version without eval, $argslist (which I was too
| lazy to type in my example) is broken up before IFS gets altered to
| adjust the way it is broken up, with  eval, IFS is set first.
| 
| This is also possible
| 
| epsilon$ IFS=';'; set -- $args
| epsilon$ echo $#
| 2
| 
| but then IFS needs to be explicitly set back to its old value afterwards,
| with the IFS= prefix to eval (or just set) the shell takes care of that.

Great! Thanks for clarifying. This is a neat trick :-)

christos

<Prev in Thread] Current Thread [Next in Thread>