Help running programs from Mac Desktop in Terminal

I am new to Ruby. My version is 2.0. I am running on Yosemite OSx.

What I am trying to do is a write a program in the text editor, save it
in .rb format, and run that program using the terminal on Mac.

I made a simple program …

puts “hello world”

and then saved it (to my desktop in a folder called ruby) as hello.rb

Now, I go into terminal and want to execute the “program”.

I have tried the following methods with no prevail…

$ ruby hello.rb <-- does not work…

It returns an error saying —> "’$’ is not allowed a global variable
name "

I’ve tried …

cd ~/
ruby hello.rb <----- did not work…

It returns no error, in fact it continues onto line 3 without noticing
reacting to what I typed.

PLEASE HELP. I am enjoying learning about Ruby so far, and am stuck at
this section of the book because of this problem!

Regards,
mac51894

Do not type the leading $. This is a common
convention used is denote what follows is a command
to be run.

Read the tutorial linked above, it gives an introduction to the command
line. Also, make sure you goto (“cd”) to the directory containing your
script.

Thank yo uso much, I’ll try that now!

Regards,
Logan McNulty