Going through the O'Reily book I get this bit of code for creating a
hello world script. The shebang line is suppossed to make it so I don't
have to type "ruby" before executing my scripts:
#!/usr/local/bin/ruby
# a nice greeting for Matz
puts "Hello, Matz!"
Problem is that I get this when I run the script:
Pinky:rubes pink$ matz.rb
-bash: matz.rb: command not found
I've searched everywhere for an answer but probably don't know how to
pose the question.
The path to ruby on my computer is actually /usr/bin/ruby and not
/usr/local/bin/ruby
I change the code in the script but still get the same error.
It's stupid but I am anal and feel like I can't go on....
Going through the O'Reily book I get this bit of code for creating a
hello world script. The shebang line is suppossed to make it so I don't
have to type "ruby" before executing my scripts:
#!/usr/local/bin/ruby
# a nice greeting for Matz
puts "Hello, Matz!"
Problem is that I get this when I run the script:
Pinky:rubes pink$ matz.rb
-bash: matz.rb: command not found
I've searched everywhere for an answer but probably don't know how to
pose the question.
The path to ruby on my computer is actually /usr/bin/ruby and not
/usr/local/bin/ruby
I change the code in the script but still get the same error.
It's stupid but I am anal and feel like I can't go on....
Any help greatly appreciated.
Thanks!
You should use the actual path to ruby on your computer. Also, make sure your script has its executable bit set:
chmod +x matz.rb
And finally, OS X only looks for executables your $PATH, which normally doesn't include your current directory. To execute a script in the current directory, do this:
Tim Hunter wrote:
> You should use the actual path to ruby on your computer. Also, make
sure
your script has its executable bit set:
chmod +x matz.rb
And finally, OS X only looks for executables your $PATH, which normally
doesn't include your current directory. To execute a script in the
current directory, do this:
./matz.rb
Thanks Tim.
None of that worked.
Here is the script that I have:
#!/usr/bin/ruby
puts "Hello, Matz!"
here is info on the ruby path and the permissions of matz.rb
Pinky:rubes pink$ which ruby
/usr/bin/ruby
Pinky:rubes pink$ ls -l
total 8
-rwxr-xr-x@ 1 pink staff 41 Nov 27 08:00 matz.rb
this is what i get when i try to run the script
Pinky:rubes pink$ matz.rb
-bash: matz.rb: command not found
this is what i get when i put ./ in front, just a prompt no out put
Pinky:rubes pink$ ./matz.rb
Pinky:rubes pink$
this always works as it should
Pinky:rubes pink$ ruby matz.rb
Hello, Matz!
the ./ made a difference but I am puzzled why there is no output.
On Thu, Nov 27, 2008 at 8:36 AM, Johnnie Lieske <generic@frankenstein.com> wrote:
Tim Hunter wrote:
> You should use the actual path to ruby on your computer. Also, make
sure
your script has its executable bit set:
chmod +x matz.rb
And finally, OS X only looks for executables your $PATH, which normally
doesn't include your current directory. To execute a script in the
current directory, do this:
./matz.rb
Thanks Tim.
None of that worked.
Here is the script that I have:
#!/usr/bin/ruby
puts "Hello, Matz!"
here is info on the ruby path and the permissions of matz.rb
Pinky:rubes pink$ which ruby
/usr/bin/ruby
Pinky:rubes pink$ ls -l
total 8
-rwxr-xr-x@ 1 pink staff 41 Nov 27 08:00 matz.rb
this is what i get when i try to run the script
Pinky:rubes pink$ matz.rb
-bash: matz.rb: command not found
this is what i get when i put ./ in front, just a prompt no out put
Pinky:rubes pink$ ./matz.rb
Pinky:rubes pink$
this always works as it should
Pinky:rubes pink$ ruby matz.rb
Hello, Matz!
the ./ made a difference but I am puzzled why there is no output.
On Nov 27, 2008, at 9:26 PM, "Laurent Sansonetti" <laurent.sansonetti@gmail.com > wrote:
On Thu, Nov 27, 2008 at 8:36 AM, Johnnie Lieske > <generic@frankenstein.com> wrote:
Tim Hunter wrote:
You should use the actual path to ruby on your computer. Also, make
sure
your script has its executable bit set:
chmod +x matz.rb
And finally, OS X only looks for executables your $PATH, which normally
doesn't include your current directory. To execute a script in the
current directory, do this:
./matz.rb
Thanks Tim.
None of that worked.
Here is the script that I have:
#!/usr/bin/ruby
puts "Hello, Matz!"
here is info on the ruby path and the permissions of matz.rb
Pinky:rubes pink$ which ruby
/usr/bin/ruby
Pinky:rubes pink$ ls -l
total 8
-rwxr-xr-x@ 1 pink staff 41 Nov 27 08:00 matz.rb
this is what i get when i try to run the script
Pinky:rubes pink$ matz.rb
-bash: matz.rb: command not found
this is what i get when i put ./ in front, just a prompt no out put
Pinky:rubes pink$ ./matz.rb
Pinky:rubes pink$
this always works as it should
Pinky:rubes pink$ ruby matz.rb
Hello, Matz!
the ./ made a difference but I am puzzled why there is no output.