From: ts Date: 2006-08-12T22:50:06+09:00 Subject: Re: gets give me last arg of script ??? >>>>> "U" == Une b�vue writes: U> something i don't understand : gets give me last arg of script ??? It's normal : it make the right thing. moulon% ri Kernel#gets ------------------------------------------------------------ Kernel#gets gets(separator=$/) => string or nil ------------------------------------------------------------------------ Returns (and assigns to +$_+) the next line from the list of files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in +ARGV+ (or +$*+), or from standard input if no files are present ^^^^^^^^^^^^^^^^^^ on the command line. Returns +nil+ at end of file. The optional [...] moulon% U> notice the $*[0] is allready used in my script ??? This is bad : $ variables must not be used, it's best to use ARGV. ARGV[0] is used but was *not* removed from ARGV Try this moulon% ruby -e 'p ARGV[0]; p gets' inexistant "inexistant" -e:1:in `gets': No such file or directory - inexistant (Errno::ENOENT) from -e:1 moulon% moulon% ruby -e 'p ARGV.shift; p gets' inexistant "inexistant" Bonjour "Bonjour\n" moulon% -- Guy Decoux