I tried it in Ubuntu 14.04.2 LTS, and it is working fine
Step 1: (the purpose of the first line in designating which interpreter to use for the rest of the file), and save the file as a hello-world.rb
#!/usr/bin/env ruby
puts "Hello World!"
Step 2: (make the file executable with the below command)
chmod u+x hello-world.rb
Step 3:
./hello-world.rb
Please note that if your platform doesn't support the `#!/usr/bin/env` convention, then don't forget that the script can be run by passing it to the Ruby interpreter manually:
<path_to_ruby_interpreter> -w hello-world.rb
Posted on October 26, 2015 by Amit Pandya in Ruby, Ubuntu