Is it possible?---ruby xxx.rb arg1 arg2

Hellow guys:

It’ll be highly appreciated if you know:

In a qaz.rb, how to read and use arguments setting by command line

for example: "ruby queens.rb 8"

regards

xinwei

Hellow guys:

It’ll be highly appreciated if you know:

In a qaz.rb, how to read and use arguments setting by command line

for example: "ruby queens.rb 8"

regards

xinwei

Arguments are available in ARGV. ARGV[0] points to the first argument,
ARGV[1] the second, and so on.

James

···

-----Original Message-----
From: Chai, Xinwei [mailto:ChaiXV@ee.ualberta.ca]
Sent: Thursday, August 15, 2002 2:34 PM
To: ruby-talk ML
Subject: Is it possible?—ruby xxx.rb arg1 arg2…

Sure, use ARGS.

You may want to take a look at GetoptLong,
http://www.rubycentral.com/book/lib_standard.html

···

On Fri, Aug 16, 2002 at 06:34:17AM +0900, Chai, Xinwei wrote:

Hellow guys:

It’ll be highly appreciated if you know:

In a qaz.rb, how to read and use arguments setting by command line

for example: "ruby queens.rb 8"


_ _

__ __ | | ___ _ __ ___ __ _ _ __
’_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

  • dpkg ponders: ‘C++’ should have been called ‘D’
    #Debian

Sorry, I meant ARGV.

···

On Fri, Aug 16, 2002 at 06:56:46AM +0900, Mauricio Fernández wrote:

In a qaz.rb, how to read and use arguments setting by command line

for example: "ruby queens.rb 8"

Sure, use ARGS.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
’_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

You will not censor me through bug terrorism.
– James Troup