Quantcast
Channel: ruby
Viewing all articles
Browse latest Browse all 21

Ruby command line arguments

$
0
0

Ruby command line arguments

Ruby FAQ: How do I read command line arguments in a Ruby script (Ruby command line args)?

To read command line args in a Ruby script, use the special Ruby array ARGV to get the information you need. Here are a few examples.

1) Getting the number of command line args

To get the number of command line arguments passed in to your Ruby script, check ARGV.length, like this:


Viewing all articles
Browse latest Browse all 21

Trending Articles