So if I download and run the following code using curl, gets produces nil and doesn’t prompt anything.
str=gets
unless str.nil?
puts str
else
puts "gets produced nil"
end
Command being used (you can try it yourself)
curl https://raw.github.com/gist/3077534/06ea1c27f7bed38408d2662671f29ea758e2e54b/gets_test.rb | ruby
Is there a better/more common practice of doing this?
This may work for you:
It does for me: