From: Robert Klemme Date: 2005-10-11T16:31:52+09:00 Subject: Re: argc *argv[] in Ruby Chris Eskow wrote: > Oh, one more thing: Unlike argv in C/C++, in Ruby ARVG[0] will > contain the first argument passed in to the program, not the program > name. If you want the name of script, use the global variable $0. Adding to that there's also ARGF which is a single IO like object that reads from all command line named files: # poor man's cat # this works even without any arguments by # reading from STDIN ARGF.each_line {|line| puts line} And while we're at it, there are also two libs for option processing: http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html http://www.ruby-doc.org/stdlib/libdoc/getoptlong/rdoc/index.html I recommend OptionParser as it seems more flexible and also has very nice help output generation. Kind regards robert