From: "List.rb" Date: 2008-11-28T12:10:33+09:00 Subject: Re: Shebang! line not recognized in OS X Leopard?? On Nov 27, 2008, at 9:26 PM, "Laurent Sansonetti" wrote: > On Thu, Nov 27, 2008 at 8:36 AM, Johnnie Lieske > 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. >> > > Works for me :-) > > $ cat t.rb > #!/usr/bin/ruby > puts "Hello, Matz!" > $ chmod +x t.rb > $ ./t.rb > Hello, Matz! > $ PATH=. t.rb > Hello, Matz! > $ which ruby > /usr/bin/ruby > $ ruby -v > ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] > $ sw_vers > ProductName: Mac OS X > ProductVersion: 10.5.5 > BuildVersion: 9F33 > > Laurent > Try dos2unix on the file then rerun?