On Fri, Jun 01, 2007 at 01:59:33PM +0900, Ivan B wrote: > STDOUT.sync=true > > puts "File exists. Are you sure?" > STDOUT.flush > answer=gets.chomp > puts answer > > executing this file with any parameters (e.g. ./test.rb bla) yields > this: > > [:~/ruby]$ ./test.rb bla > File exists. Are you sure? > ./test.rb:9:in `gets': No such file or directory - "bla" (Errno::ENOENT) > from ./test.rb:9 > [:~/ruby]$ > > What gives?! You need: answer=$stdin.gets.chomp Ohterwise, gets tries to read from file(s) whose name(s) are given on the command line.