tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: rc.d/network
On Sep 20, 3:27am, kre%munnari.OZ.AU@localhost (Robert Elz) wrote:
-- Subject: Re: rc.d/network
| Date: Fri, 19 Sep 2008 19:32:33 +0000 (UTC)
| From: christos%astron.com@localhost (Christos Zoulas)
| Message-ID: <gb0uoh$omi$1%ger.gmane.org@localhost>
|
| | 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
Home |
Main Index |
Thread Index |
Old Index