P
Pawel Radecki
Hello everybody!
I'm trying to write a simple program that reads text from standard input
and writes text to standard output. The source code is as follows:
#!/usr/bin/env ruby
text = ""
while (line = gets)
text+=line
end
print text.reverse
Now I want to execute it on the Windows XP box with a pipe to redirect
results so I know that:
reverse.rb sample.txt | reverse.rb
will show me (on the screen be default) the contents of sample.txt file
in non-reversed way.
I'm executing above command line and getting this:
reverse.rb:9:in 'gets': Bad file descriptor (Errno:EBADF)
Do you have any ideas why it doesn't work?
Thanks in advance for any help!
I'm trying to write a simple program that reads text from standard input
and writes text to standard output. The source code is as follows:
#!/usr/bin/env ruby
text = ""
while (line = gets)
text+=line
end
print text.reverse
Now I want to execute it on the Windows XP box with a pipe to redirect
results so I know that:
reverse.rb sample.txt | reverse.rb
will show me (on the screen be default) the contents of sample.txt file
in non-reversed way.
I'm executing above command line and getting this:
reverse.rb:9:in 'gets': Bad file descriptor (Errno:EBADF)
Do you have any ideas why it doesn't work?
Thanks in advance for any help!