On Aug 11, 12:00=A0am, "Thind, Aman" <aman.th... / lehman.com> wrote:
> Hello,
>
> If I have a string containing variables, how can I expand them?
>
> I retrieve this string from a db so I cannot expand it at the time of
> assignment.
>
> Eg:
>
> myaction =3D 'perl #{ENV['HOME_SCRIPTS']}/myscript.pl -#{params[:date]}'
>
> I want to be able to do:
>
> system(myaction)
>
> but for this I have to expand the vars inside the script first.

Have you tried putting double quotes (rather than single quotes)
around the String in question?

v =3D "hello"
w =3D "1. #{v}"  # -> 1. hello
x =3D '2. #{v}'  # -> 2. #{v}

>
> This message is intended only for the personal and confidential use of th=
e designated recipient(s) named above. =A0If you are not the intended recip=
ient of this message you are hereby notified that any review, dissemination=
, distribution or copying of this message is strictly prohibited. =A0This c=
ommunication is for information purposes only and should not be regarded as=
 an offer to sell or as a solicitation of an offer to buy any financial pro=
duct, an official confirmation of any transaction, or as an official statem=
ent of Lehman Brothers. =A0Email transmission cannot be guaranteed to be se=
cure or error-free. =A0Therefore, we do not represent that this information=
 is complete or accurate and it should not be relied upon as such. =A0All i=
nformation is subject to change without notice.

Given all of that, I can't help but feel I've done something wrong by
daring to answer your question....  Please tell the Brothers Lehman
that I didn't mean to do it.  Please understand that when I crossed
the Brother Ringling, I returned home one evening to find a clown's
nose in my bed, so I'm a little skittish.

Eric

=3D=3D=3D=3D

Ruby training and Rails training available at http://LearnRuby.com .