Can Not Get Ruby to Run in Windows CMD Window


#1

Hi All,

As the subject says…“Can Not Get Ruby to Run in Windows CMD Window”

I have Ruby installed: C:\Ruby

I was reading the Programming Ruby - The Pragmatic Programmers’
Guide. It says to bring up the Shell Prompt and type Ruby, then puts
“Hello World”

When I type Ruby puts “Hello World” nothing happens. What am
I doing wrong?

Thank you.

Brad


#2

Type Ctrl+Z after that and you would get the output. I would recommed
that
you type your programme in an editor and then run them using

c:> ruby yourprogramfile.rb

The best way however if you would like to learn ruby is use Interactive
Ruby
(IRB). Typing irb at the command prompt would give you the IRB shell.


#3

On Feb 3, 9:21 am, “Brad” removed_email_address@domain.invalid wrote:

When I type Ruby puts “Hello World” nothing happens. What am
I doing wrong?

Thank you.

Brad

the ruby executable reads from stdin (and is totally silent) until you
send it a ctrl-D, I think. At that point it will process the text you
typed in.

_Kevin


#4

On Feb 3, 9:21 am, “Brad” removed_email_address@domain.invalid wrote:

When I type Ruby puts “Hello World” nothing happens. What am
I doing wrong?

Thank you.

Brad

In addition to what Kevin said, keep in mind that “ruby” runs the Ruby
interpreter, while “irb” runs the interactive ruby interpreter.

Mully