Author: roger pepperoger peppe Date: Aug 14, 2008 05:18
On Thu, Aug 14, 2008 at 12:20 PM, kazumi iwane gmail.com> wrote:
> if you want to delay the expansion of an env var until fn invocation,,use eval.
>
> %% fn foo {eval echo $$bar}
sorry, but that's so, so wrong.
1) $$bar gives the value of the variable
named by the contents of the variable bar,
so that the above, given that $bar contains 'baz'
will echo $baz.
2) $$bar above is evaluated _before_ eval is invoked,
so the line is not very different from {echo $$bar}, except that
if $$bar holds any syntax characters they'll get interpreted by the shell.
it's almost never necessary to use eval with rc.
|