pass command line param. to ruby script?

R

reed.adam

I'm trying to find out if it's possible, and if so, how to pass a
command line parameter to a ruby script.

The reason for inquiring is that I'd like to have a for loop that runs
a few automated test cases (watir), but I want the user to be able to
specify the variable in the loop without editing the script itself.

Thanks!
 
R

reed.adam

What is that doing exactly? Is ARGV[0] the variable name for the first
parameter after the ruby script name?

Tim said:
put the following in the file and run it like so: ruby test.rb hello

#test.rb
puts ARGV[0] if ARGV[0]


I'm trying to find out if it's possible, and if so, how to pass a
command line parameter to a ruby script.

The reason for inquiring is that I'd like to have a for loop that runs
a few automated test cases (watir), but I want the user to be able to
specify the variable in the loop without editing the script itself.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top