Reputation:
I installed ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] on my Windows XP laptop.
When I run ruby.exe I get a blank DOS Shell window. No expected "irb(main):001:0>" at the top left of the command prompt. I can type into the shell but, any code I type in actually does anything when pressing enter.
I should mention that I can start IRB from the cmd.exe DOS shell and it functions perfectly. Additionally I have the System Variables path set to c:\ruby\bin so I know that is ok.
Any ideas what could be going wrong and how to fix it?
Upvotes: 2
Views: 2448
Reputation: 177574
More precisely, running ruby
by itself still gives you a ruby interpreter, but you'll miss these features of IRB: The interactive prompt with line editing, immediate execution, and automatic printing of the result.
For example:
C:\> ruby
puts "hello"
"test string"
Press Ctrl+Z and then Enter. It outputs
hello
Ctrl+Z send an "end of file" signal to the interpreter. Unlike IRB, it doesn't consume input one line at a time by default, so it waited to output "hello". The "test string" wasn't displayed at all.
P.S. Conversely, you can also pass the name of a file to IRB (just irb hello.rb
), and it will run it as if you typed it in, displaying each line of code and the result as it goes.
Upvotes: 2
Reputation: 124642
ruby.exe != irb.bat
irb is a batch file that runs ruby.exe as an interactive shell. It actually passes a file called "irb" (no extension) as the parameter. You want to be running irb.
Upvotes: 3