I wrote a small script that takes a filename from the command line argument,
reads in the file, does some stuff and produces some output.  It works and
I'm reasonably happy with it.  Now I'd like to make the script smarter about
handling command line arguments.

So what I'd like to do is something like this:

If ARGV[0] == nil
 puts "you need to specify a filename"
 exit
end

if ! File.exists?( ARGV[0] )
 puts "Input file is incorrect or cannot be found."
 exit
end


Question: Is this the right way to do this sort of thing?  I'm new to
working with arguments.  I read up on the "exit" command but I didn't really
follow all of the thread explanation.

Please let me know.  Thanks.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to