On Sep 30, 2006, at 4:20 PM, Une bue wrote:

> i do have about the same kind of prob.
>
> say, i've a ruby script having two to four arguments, after having
> parsed them if i do a :
>
> r = gets.chomp
>
> (i'm looking for a full YES)
>
> i get an error :
>
> /Users/yvon/bin/chgext.rb:23:in `gets': No such file or directory - -a
> (Errno::ENOENT)
>
> line 23 being :
> r = gets.chomp
>
> the "-a" being the first arg of the script called like that :
>
> ~%> chgext.rb -a html shtml
>
> could curses solve my prob here also ???

Try using STDIN.gets.

$ ruby -e 'gets()' a b c
-e:1:in `gets': No such file or directory - a (Errno::ENOENT)
         from -e:1
$ ruby -e 'STDIN.gets' a b c
...
$

See:
$ ri Kernel#gets
$ ri IO#gets

-- Daniel