Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Beginner question pt.2

Reply
Thread Tools

Beginner question pt.2

 
 
Calvin
Guest
Posts: n/a
 
      05-19-2009
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
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      05-19-2009
On 19.05.2009 05:33, Calvin wrote:
> 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?


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

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Reply With Quote
 
 
 
 
Calvin
Guest
Posts: n/a
 
      05-19-2009
On May 18, 11:15*pm, Robert Klemme <(E-Mail Removed)> wrote:
> On 19.05.2009 05:33, Calvin wrote:
>
>
>
>
>
> > 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?

>
> 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
>
> --
> 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.
 
Reply With Quote
 
Calvin
Guest
Posts: n/a
 
      05-19-2009
On May 19, 5:39*am, Calvin <(E-Mail Removed)> wrote:
> On May 18, 11:15*pm, Robert Klemme <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On 19.05.2009 05:33, Calvin wrote:

>
> > > 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?

>
> > 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

>
> > --
> > 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.- Hide quoted text -
>
> - 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
 
Reply With Quote
 
Martin DeMello
Guest
Posts: n/a
 
      05-19-2009
On Tue, May 19, 2009 at 6:50 PM, Calvin <(E-Mail Removed)> 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

 
Reply With Quote
 
Calvin
Guest
Posts: n/a
 
      05-19-2009
On May 19, 6:36*am, Martin DeMello <(E-Mail Removed)> wrote:
> On Tue, May 19, 2009 at 6:50 PM, Calvin <(E-Mail Removed)> 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


Hi Martin,

I am using bash... what is "tab completion" and how do I do it?
 
Reply With Quote
 
Mk 27
Guest
Posts: n/a
 
      05-19-2009
Calvin wrote:
> On May 19, 6:36´┐Żam, Martin DeMello <(E-Mail Removed)> 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).
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Calvin
Guest
Posts: n/a
 
      05-19-2009
On May 19, 9:16*am, Mk 27 <(E-Mail Removed)> wrote:
> Calvin wrote:
> > On May 19, 6:36 am, Martin DeMello <(E-Mail Removed)> 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).
> --
> Posted viahttp://www.ruby-forum.com/.


That's pretty useful information! Thanks a bunch for your time!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner's Beginner william nelson Ruby 7 04-11-2011 11:23 PM
beginner's question.. Scott Needham Wireless Networking 4 09-06-2005 12:52 AM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= ASP .Net 7 02-03-2005 02:47 PM
Tutorial for beginner/ Tutorial voor beginner Rensjuh C++ 7 09-02-2004 12:41 AM
Beginner question: What trigs processes Jerker Hammarberg VHDL 16 07-22-2003 03:58 PM



Advertisments