# Beginner question pt.2

**URL:** <https://www.ruby-forum.com/t/beginner-question-pt-2/168281>\
**Category:** Ruby\
**Created:** [May 19, 2009, 5:36am UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281 "2009-05-19T05:36:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 5:36am UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/1 "2009-05-19T05:36:06Z")

</div>

When I type this into the terminal it works… but I am wondering if I  
am going about things the right way:

$ /opt/local/bin/ruby1.9 -v

$ cd

$ cd Desktop

$ cd programs

$ ruby1.9 calc.rb

then the math equation answer from calc.rb shows up in the terminal.  
Am I correct in thinking that ruby 1.9.1 is the ruby that is working  
and not ruby 1.8.6?

Thank you for your time,

Calvin Stephens

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 8:22am UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/2 "2009-05-19T08:22:21Z")

</div>

On 19.05.2009 05:33, Calvin wrote:

> $ ruby1.9 calc.rb
> 
> then the math equation answer from calc.rb shows up in the terminal.  
> Am I correct in thinking that ruby 1.9.1 is the ruby that is working  
> and not ruby 1.8.6?

It’s likely but program names can be changed arbitrarily. If you want  
to be sure you can easily find out by entering

ruby1.9 -v

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/3 "2009-05-19T14:40:44Z")

</div>

On May 18, 11:15 pm, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > and not ruby 1.8.6?  
> > –  
> > remember.guy do |as, often| as.you\_can - without endhttp://blog.rubybestpractices.com/- Hide quoted text -
> 
> - Show quoted text -

Thanks Robert!

When I type in Ruby1.9 -v i get: ruby 1.9.1p129 with some other text.

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 3:20pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/4 "2009-05-19T15:20:36Z")

</div>

On May 19, 5:39 am, Calvin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > then the math equation answer from calc.rb shows up in the terminal.  
> > > robert
> 
> - Show quoted text -  
> I am also wondering if I could just type this into my terminal to get  
> ruby1.9 to run a ruby file:

$ cd

$ cd Desktop

$ cd programs

$ ruby1.9 calc.rb

Is this correct or incorrect?

Thanks for your time,

Calvin

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/5 "2009-05-19T15:37:40Z")

</div>

On Tue, May 19, 2009 at 6:50 PM, Calvin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am also wondering if I could just type this into my terminal to get  
> ruby1.9 to run a ruby file:
> 
> $ cd  
> $ cd Desktop  
> $ cd programs  
> $ ruby1.9 calc.rb
> 
> Is this correct or incorrect?

Yes, that’s correct, as long as ruby1.9 is in your path.

Also you can say cd ~/Desktop/programs rather than three separate cds.  
And don’t miss tab completion, if you’re using bash.

martin

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 6:16pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/6 "2009-05-19T18:16:51Z")

</div>

Calvin wrote:

> On May 19, 6:36ï¿½am, Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Yes, that’s correct, as long as ruby1.9 is in your path.
> > 
> > Also you can say cd ~/Desktop/programs rather than three separate cds.  
> > And don’t miss tab completion, if you’re using bash.
> > 
> > martin
> 
> Hi Martin,
> 
> I am using bash… what is “tab completion” and how do I do it?

Start typing enough of the directory name, and by pressing tab bash will  
finish it for you – if what you have is enough to identify it uniquely.

For example, if you are in /home/me and you want to get to  
scripts/ruby/tests, try “cd scr” don’t press return, press tab and scr  
will expand to scripts, then “/ru” and do the same thing, then “/te” tab  
and you’ll have  
cd scripts/ruby/tests  
now you can hit return, and all you actually typed was cd  
scr[TAB]/ru[TAB]/te[TAB]

Hopefully that is clear enough…a lot of CLI (and GUI) apps use tab  
completion (eg, google).

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/7 "2009-05-19T17:56:05Z")

</div>

On May 19, 6:36 am, Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yes, that’s correct, as long as ruby1.9 is in your path.
> 
> Also you can say cd ~/Desktop/programs rather than three separate cds.  
> And don’t miss tab completion, if you’re using bash.
> 
> martin

Hi Martin,

I am using bash… what is “tab completion” and how do I do it?

---

<div class="post-metadata">

**Author:** ![calvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@calvin](https://www.ruby-forum.com/u/calvin)\
**Post date:** [May 19, 2009, 10:29pm UTC](https://www.ruby-forum.com/t/beginner-question-pt-2/168281/8 "2009-05-19T22:29:56Z")

</div>

On May 19, 9:16 am, Mk 27 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Hi Martin,  
> > cd scripts/ruby/tests  
> > now you can hit return, and all you actually typed was cd  
> > scr[TAB]/ru[TAB]/te[TAB]
> 
> ## Hopefully that is clear enough…a lot of CLI (and GUI) apps use tab completion (eg, google).
> 
> Posted viahttp://www.ruby-forum.com/.

That’s pretty useful information! Thanks a bunch for your time!
