tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rc.d/network

    Date:        Fri, 19 Sep 2008 19:32:33 +0000 (UTC)
    From: (Christos Zoulas)
    Message-ID:  <gb0uoh$omi$>

  | Why "eval set -- \$argslist" instead of "set -- $argslist"?

epsilon$ args="a b c;d e f"
epsilon$ IFS=';' set -- $args
epsilon$ echo $#
epsilon$ IFS=';' eval set -- \$args
epsilon$ echo $#

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 $#

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.


Home | Main Index | Thread Index | Old Index