Put a argument into a Ruby script

Hi,

I would like to send a value in a script by using a argument. For
example, that could be my command:

$ ./script.rb Hello world

And that could be my script:

puts “#{$1} #{$2}”

But I have try it and it do not work… Thank you for your help.

It’s perfect! xD
Thank you Jeremy

I believe the ARGV array is what you’re looking for. :slight_smile:

–Jeremy

On Nov 14, 2007 11:55 AM, Zangief I. [email protected] wrote:

But I have try it and it do not work… Thank you for your help.

Posted via http://www.ruby-forum.com/.


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book

My blogs:

http://www.rubyinpractice.com/