Kaye Ng wrote in post #1090172:
> Thanks guys! So now how do I run a simple Ruby program inside Ubuntu?
> I have a file named Dungeon_interactive.rb
> In Windows, I just typed that file name in command prompt and it would
> run.
> It's a simple, text based game, a Ruby exercise for beginners.
>
> How do I run it in Ubuntu?
>
> Thanks!!!

You can simply type:

$ ruby interactive.rb

... from the shell prompt, and that should do it.  The dollar sign
indicates your shell prompt and is not meant to be typed.  Only type
what follows the dollar sign.

To make your Ruby file executable, first find your Ruby executable:

$ which ruby

---example output---
/usr/bin/ruby

...then add this line as the FIRST line of your Ruby file:

#!/usr/bin/ruby

IMPORTANT: Make sure that path matches the path found using the "which"
command.

Lastly, type:

$ chmod 755 interactive.rb

...to make your file executable.  Now all you need to do is type:

$ ./interactive.rb

...and it should be executed.

-- 
Posted via http://www.ruby-forum.com/.