Terminal not executing Ruby files

后端 未结 4 1958
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-11 06:24

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

4条回答
  •  渐次进展
    2021-02-11 06:55

    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.

提交回复
热议问题