On Feb 1, 1:34am, Jeff Peng <jeffp... / netzero.net> wrote:
> 在 2010-02-01一的 13:15 +0900,RichardOnRails写道:
>
> > gets looks to ARGV, if populated, for its source of data. That ists
> > documented behavior.
>
> I changed the script to:
>
> dir=ARGV[0]
> ARGV.clear
> puts "Delete indicated item [yes, no]"
> STDOUT.flush
> response = gets.chomp  # doesn't go to STDIN !!!
> puts case response
>  when /^yes$/i; "Deleting"
>  when /^no$/i; "Quiting"
>  else; "Huh?"
>  end
> puts "EOJ"
>
> It works fine for me.
>
> $ ruby pause.rb 323
> Delete indicated item [yes, no]
> yes
> Deleting
> EOJ
>
> --
> Jeff Peng
> Email: jeffp... / netzero.net
> Skype: compuperson

>> ARGV.clear

Excellent.  My heavy-handed method pales in light of your solution.
Many thanks, Jeff
-
Richard