I\'m pretty much entirely new to programming, so bear with me. I am on a Macbook Pro running 10.6.6.
At the beginning of the \"Learn to Program\" tutorial are these dir
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
C:\Ruby Programs>ruby calc.rb
ruby: No such file or directory -- calc.rb (LoadError)
C:\Ruby Programs>ruby calc.rb.txt
3
One should not have to add the .txt extension while attempting to run the program from whithin the program's home folder. I have to though.
Did you call your file Calc.rb and saved it as a rb file to. becouse then its called internaly. Calc.rb.rb
and be sure to run cmd from desktop :D
In Terminal, did you change your current directory to your desktop before running your program ?
If your program is stored on your desktop, you first need to change directory to your desktop or your Ruby script will not be found.
$ cd Desktop
$ ruby calc.rb
If you have named your file "Calc.rb" you'll need to run ruby Calc.rb
(capital "C").
Also make sure that you're navigating the /Desktop
directory — e.g. type
cd ~/Desktop
ruby Calc.rb
You can use ls
to get a list of all the files in the current directory. You could use that to see if the file you're trying to execute actually exists.