# Interactive shell on windows

**URL:** <https://rubytalk.org/t/interactive-shell-on-windows/22528>\
**Category:** ruby-talk\
**Created:** [16 November 2005 17:47 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528 "2005-11-16T17:47:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![py1](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@py1](https://rubytalk.org/u/py1)\
**Post date:** [16 November 2005 17:47 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/1 "2005-11-16T17:47:17Z")

</div>

I downloaded and installed Ruby via the One-Click installer, version  
1.8.2-15. So I open a command prompt (on windows xp) and type "ruby".

After typing "ruby" i type,  
puts "Hello world!"

....but I dont see Hello world! printed out. Am I missing something, am  
I doing something wrong? I happened to try pressing Ctrl+Z to exit  
ruby (..forgive me I am coming from Python)...and then I saw "hello  
world!" printed out....but that doesn't seem right.

Thanks

---

<div class="post-metadata">

**Author:** ![Curt\_Hibbs2](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Curt\_Hibbs2](https://rubytalk.org/u/Curt_Hibbs2)\
**Post date:** [16 November 2005 17:50 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/2 "2005-11-16T17:50:55Z")

</div>

Instead of typing "ruby", type "irb" (stands for interactive ruby).

Curt

> **···**
>
> On 11/16/05, py \<codecraig@gmail.com\> wrote:
> 
> > I downloaded and installed Ruby via the One-Click installer, version  
> > 1.8.2-15. So I open a command prompt (on windows xp) and type "ruby".
> > 
> > After typing "ruby" i type,  
> > puts "Hello world!"
> > 
> > ....but I dont see Hello world! printed out. Am I missing something, am  
> > I doing something wrong? I happened to try pressing Ctrl+Z to exit  
> > ruby (..forgive me I am coming from Python)...and then I saw "hello  
> > world!" printed out....but that doesn't seem right.
> > 
> > Thanks

---

<div class="post-metadata">

**Author:** ![py1](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@py1](https://rubytalk.org/u/py1)\
**Post date:** [16 November 2005 17:57 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/3 "2005-11-16T17:57:17Z")

</div>

Curt Hibbs wrote:

> Instead of typing "ruby", type "irb" (stands for interactive ruby).

Thanks! Apparently the "Programming Ruby" .chm (help) file that comes  
with ruby needs to be fixed. It says to use "ruby" 🙂

thanks!

---

<div class="post-metadata">

**Author:** ![Matthew\_Desmarais](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Matthew\_Desmarais](https://rubytalk.org/u/Matthew_Desmarais)\
**Post date:** [16 November 2005 18:07 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/4 "2005-11-16T18:07:29Z")

</div>

py wrote:

> Curt Hibbs wrote:
> 
> > Instead of typing "ruby", type "irb" (stands for interactive ruby).  
> > &nbsp;&nbsp;&nbsp;  
> > Thanks! Apparently the "Programming Ruby" .chm (help) file that comes  
> > with ruby needs to be fixed. It says to use "ruby" 🙂
> 
> thanks!

No kidding! Where did it say that?

---

<div class="post-metadata">

**Author:** ![py1](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@py1](https://rubytalk.org/u/py1)\
**Post date:** [16 November 2005 18:17 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/5 "2005-11-16T18:17:18Z")

</div>

Matthew Desmarais wrote:

> No kidding! Where did it say that?

Well for the One-Click installer for Windows, version 1.8.2-15 includes  
ProgrammingRuby.chm (under the ruby directory).

In that help file look under Preface/Running Ruby/Interactive Ruby  
....copied/pasted below...

[excerpt]  
"Interactive Ruby

The easiest way to run Ruby interactively is simply to type ``ruby'' at  
the shell prompt.

% ruby  
puts "Hello, world!"  
^D  
Hello, world!  
[/excerpt]

See 🙂

---

<div class="post-metadata">

**Author:** ![Curt\_Hibbs2](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Curt\_Hibbs2](https://rubytalk.org/u/Curt_Hibbs2)\
**Post date:** [16 November 2005 18:22 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/6 "2005-11-16T18:22:20Z")

</div>

I see what's going on here. Ruby with no args reads from the standard input  
(in this case the terminal) and runs whatever it gets as soon as the input  
stream terminates, which is the "^D", and not your enter key. If you were to  
use this technique, you would have to tye "ruby" again to execute something  
else.

IRB executes and the enter key and then waits for another line to execute.  
This is, obviously, much more convenient! 🙂

Curt

> **···**
>
> On 11/16/05, py \<codecraig@gmail.com\> wrote:
> 
> > Matthew Desmarais wrote:  
> > \> No kidding! Where did it say that?
> > 
> > Well for the One-Click installer for Windows, version 1.8.2-15 includes  
> > ProgrammingRuby.chm (under the ruby directory).
> > 
> > In that help file look under Preface/Running Ruby/Interactive Ruby  
> > ....copied/pasted below...
> > 
> > [excerpt]  
> > "Interactive Ruby
> > 
> > The easiest way to run Ruby interactively is simply to type ``ruby'' at  
> > the shell prompt.
> > 
> > % ruby  
> > puts "Hello, world!"  
> > ^D  
> > Hello, world!  
> > [/excerpt]
> > 
> > See 🙂

---

<div class="post-metadata">

**Author:** ![Hugh\_Sasse](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@Hugh\_Sasse](https://rubytalk.org/u/Hugh_Sasse)\
**Post date:** [16 November 2005 18:27 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/7 "2005-11-16T18:27:48Z")

</div>

> Matthew Desmarais wrote:  
> \> No kidding! Where did it say that?
> 
> Well for the One-Click installer for Windows, version 1.8.2-15 includes  
> ProgrammingRuby.chm (under the ruby directory).
> 
> In that help file look under Preface/Running Ruby/Interactive Ruby  
> ....copied/pasted below...
> 
> [excerpt]  
> "Interactive Ruby
> 
> The easiest way to run Ruby interactively is simply to type ``ruby'' at  
> the shell prompt.
> 
> % ruby  
> puts "Hello, world!"  
> ^D  
> Hello, world!  
> [/excerpt]
> 
> See 🙂

But you said:

After typing "ruby" i type,  
puts "Hello world!"

....but I dont see Hello world! printed out.

So did you type the end-of-file mark for your system (which is what  
ctrl-d means on unix)?

Then read 7 short paragraphs and you meet IRB, which has it's own  
champter in the contents.

> 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hugh

> **···**
>
> On Thu, 17 Nov 2005, py wrote:

---

<div class="post-metadata">

**Author:** ![Matthew\_Desmarais](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Matthew\_Desmarais](https://rubytalk.org/u/Matthew_Desmarais)\
**Post date:** [16 November 2005 18:31 UTC](https://rubytalk.org/t/interactive-shell-on-windows/22528/8 "2005-11-16T18:31:20Z")

</div>

Curt Hibbs wrote:

> > Matthew Desmarais wrote:  
> > &nbsp;&nbsp;&nbsp;
> > 
> > > No kidding! Where did it say that?  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > 
> > Well for the One-Click installer for Windows, version 1.8.2-15 includes  
> > ProgrammingRuby.chm (under the ruby directory).
> > 
> > In that help file look under Preface/Running Ruby/Interactive Ruby  
> > ....copied/pasted below...
> > 
> > [excerpt]  
> > "Interactive Ruby
> > 
> > The easiest way to run Ruby interactively is simply to type ``ruby'' at  
> > the shell prompt.
> > 
> > % ruby  
> > puts "Hello, world!"  
> > ^D  
> > Hello, world!  
> > [/excerpt]
> > 
> > See 🙂  
> > &nbsp;&nbsp;&nbsp;  
> > I see what's going on here. Ruby with no args reads from the standard input  
> > (in this case the terminal) and runs whatever it gets as soon as the input  
> > stream terminates, which is the "^D", and not your enter key. If you were to  
> > use this technique, you would have to tye "ruby" again to execute something  
> > else.
> 
> IRB executes and the enter key and then waits for another line to execute.  
> This is, obviously, much more convenient! 🙂
> 
> Curt

Yup. I was gonna respond with this as well, but I'll just second Curt instead.

Get to know irb if you're experimenting with Ruby. It's just the kind of thing  
that a person coming from Python expects to see when they run ruby with  
no arguments.

Well, almost. irb doesn't play dumb when you want to quit. 😉

> **···**
>
> > On 11/16/05, py \<codecraig@gmail.com\> wrote:
