------art_28050_98984.1188299352410
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

This worked like a charm!

Thank you

Victor


On 8/27/07, Stefano Crocco <stefano.crocco / alice.it> wrote:
>
> Alle luned27 agosto 2007, Victor Reyes ha scritto:
> > Team,
> >
> > I would like to enter a value at execution time within the *system* key
> > world environment.
> > However, I am having difficulties entering a value within a quoted
> string.
> >
> > For example, I can hard code the following and it works fine:
> >
> > system("start putty.exe -X -ssh -pw mypassword myuserid@myhostname")
> >
> > But this requires hard coding the password in the script.
> > I would like to do something like the following:
> >
> > system("start putty.exe -X -ssh -pw " ARGV[0] " myuserid@myhostname")
> >
> > Where: ARGV[0] holds the password entered by the invoker of the script.
> >
> > Is there a way to substitute within a quoted string?
> > Is there a better way to do this?
> >
> > Thank you
> >
> > Victor
>
> You need string interpolation:
>
> system("start putty.exe -X -ssh -pw #{ARGV[0]} myuserid@myhostname")
>
> In a double quoted string (as well as in a regexp or backtick expression)
> you
> can substitute insert the value of any expression by enclosing it in #{}:
>
> a = 2
>
> puts "a is #{a}"
>
> => a is 2
>
> This doesn't work in single-quoted strings.
>
> puts 'a is #{a}'
>
> => a is #{a}
>
> I hope this helps
>
> Stefano
>
>

------art_28050_98984.1188299352410--