--0016e656b6ca37efa00487cdec20 Content-Type: text/plain; charset=ISO-8859-1 On Sat, May 29, 2010 at 2:43 PM, Emma Pidre <equisigriegazeta / gmail.com>wrote: > Hi, i am in Osx and i had installed Ruby 1.8.7. I want to make a > tutorial, i am a beginner in ruby. My problem is that when i want to > execute a program on ruby, example: code.rb, with "ruby code.rb" on > Terminal, like all tutorials sais, a error come back: "-bash: code.rb: > command not found" > > Well, there is a part that i am missing. Please help me. > -- > Posted via http://www.ruby-forum.com/. > > Expounding on Francesco's answer: # add a shebang to the top of a file called hello_world.rb # this directs the system(?) to use Ruby to interpret the file $ echo '#!/usr/bin/env ruby' > hello_world.rb # append a statement that will output "hello world" to hello_world.rb $ echo 'puts "hello world"' >> hello_world.rb # set permissions of hello_world.rb so that you can execute it $ chmod 755 hello_world.rb # execute hello_world.rb and see that it outputs "hello world" # the ./ in front is important, it says the file is located in the current directory $ ./hello_world.rb hello world --0016e656b6ca37efa00487cdec20--