# Really basic Ruby question

**URL:** <https://www.ruby-forum.com/t/really-basic-ruby-question/87175>\
**Category:** Ruby\
**Created:** [March 25, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175 "2006-03-25T20:24:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/1 "2006-03-25T20:24:05Z")

</div>

I’m learning Ruby from the Learn to Program tutorial by Chris P…

On [http://pine.fm/LearnToProgram/?Chapter=01](http://pine.fm/LearnToProgram/?Chapter=01), he mentions saving a  
calc.rb file after typing in “puts 1 + 2” in my text editor , then  
going to the command line and typing “ruby calc.rb”, and getting the  
results “3” returned.

I am not getting this result; instead I’m getting a message that the  
file or directory can’t be found. I’m using the built-in Scintilla text  
editor which comes with Ruby.

How do I get the command line to see the saved file?

Thanks in advance for your assistance.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 8:39pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/2 "2006-03-25T20:39:55Z")

</div>

Hi,

Looks like you are using Scite editor. If so, you can press F5 and see  
program output directly in Scite.

–  
Martins

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/3 "2006-03-25T20:40:15Z")

</div>

What directory is the saved file in would be my first question.

ruby /path/to/calc.rb

would be the first thing that comes to mind.

David Newberger  
651.271.9045  
removed\_email\_address@domain.invalid  
[http://www.davidnewberger.com](http://www.davidnewberger.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/4 "2006-03-25T20:41:44Z")

</div>

Have you saved the program to file called ‘calc.rb’ and run ‘ruby  
calc.rb’ from the directory it’s in?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 8:49pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/5 "2006-03-25T20:49:27Z")

</div>

removed\_email\_address@domain.invalid wrote:

> How do I get the command line to see the saved file?

You may be opening the command prompt in some default home directory,  
which is not the same place where you saved the Ruby file.

When you save the file in Scintilla, make sure you save it to c:\calc.rb

Then, when you get a command prompt, go to the C: drive, then change to  
the root drive:

c:\> cd \

Then try running ruby calc.rb.

If that works, all is good.

You will probably be able to run it by just typing the file name and  
hitting Enter, too, if the Ruby installation set up the filetype  
execution association for you.

Now, I don’t generally advocate saving your files to the root of the C:  
drive, so decide where you want to place the files, and then just figure  
out how to navigate there once you have a command prompt.

–  
James B.

“In Ruby, no one cares who your parents were, all they care  
about is if you know what you are talking about.”

- Logan C.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 26, 2006, 11:05am UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/6 "2006-03-26T11:05:42Z")

</div>

On 25 Mar 2006, at 20:03, removed\_email\_address@domain.invalid wrote:

> Thank you. It works!

If you are learning, you might want to try the interactive ruby  
interpreter: irb. That will save you writing things, saving them, and  
trying them. For simple tests it is very quick. To use it, go to your  
command line and type:

```
irb

```

And then you’re be able to type “puts 1 + 2” and see the result  
directly.

Have fun anyway!

Cheers,  
Benjohn

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 9:04pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/7 "2006-03-25T21:04:04Z")

</div>

Thank you. It works!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 26, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/really-basic-ruby-question/87175/8 "2006-03-26T17:28:59Z")

</div>

Thank you very much for the suggestion.
