Brian Candler
5/11/2007 6:54:00 AM
On Fri, May 11, 2007 at 12:28:15PM +0900, Watanabe Carcass wrote:
> This might seem weird, I just started Ruby, so don't know much about it,
> HOW CAN I PASS ARGUMENTS AS A STRING FROM A UNIX TERMINAL INTO A RUBY
> SCRIPT?
For small arguments you can stick them on the command line, and they will be
available in the array ARGV. But if those arguments contain spaces you'll
have to be careful with quoting.
$ cat x.rb
puts "arg 0 = #{ARGV[0]}"
puts "arg 1 = #{ARGV[1]}"
$ ruby x.rb foo "bar baz"
arg 0 = foo
arg 1 = bar baz