How to execute a Ruby script in Terminal?

前端 未结 9 1636
南笙
南笙 2020-12-04 06:15

I\'ve set everything up that I need on my Mac (Ruby, Rails, Homebrew, Git, etc), and I\'ve even written a small program. Now, how do I execute it in Terminal? I wrote the pr

9条回答
  •  孤街浪徒
    2020-12-04 07:18

    For those not getting a solution for older answers, i simply put my file name as the very first line in my code.

    like so

     #ruby_file_name_here.rb
    
     puts "hello world"
    

提交回复
热议问题