"ts" <decoux / moulon.inra.fr> schrieb im Newsbeitrag
news:200306251325.h5PDP4K06015 / moulon.inra.fr...
> >>>>> "S" == Shashank Date <sdate / everestkc.net> writes:
>
>  Try this
>
> S>     C:\>ruby -ve 'str = "a=2"; eval(str,binding); puts a'
>
> svg% ruby -ve 'a=nil; str = "a=2"; eval(str,binding); puts a'
> ruby 1.8.0 (2003-06-24) [i686-linux]
> 2
> svg%

That's cheating: you assign to a before the eval. :-))

This works, but is ugly:
ruby -e 'str = "a=2"; eval(str,binding); puts eval("a",binding)'

Or:

ruby -e 'b=binding; str = "a=2"; eval(str,b); puts eval("a",b)'

Though I'm still not satisfied...

    robert