Shebang! on Leopard

Hey everyone,

having a little trouble with shebang! on a iMac running Leopard.

been looking at the other posts and none of the solutions seem to be
working.

I'm new to Ruby, and would really like to figure this out before I move
on with my book.

So I'm trying to get this script to run:

puts "Hello, Matz!"

I ran "which ruby" from the terminal and the path says: /usr/bin/ruby

so I edited the script to:
#!/usr/bin/ruby
puts "Hello, Matz!"

and I get the following error: -bash: matz.rb: command not found

So what am I missing here?

Thanks

···

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

Does your script file have Unix line endings? m.

···

Paul M. <paul.maxfield007@gmail.com> wrote:

Hey everyone,

having a little trouble with shebang! on a iMac running Leopard.

been looking at the other posts and none of the solutions seem to be
working.

I'm new to Ruby, and would really like to figure this out before I move
on with my book.

So I'm trying to get this script to run:

puts "Hello, Matz!"

I ran "which ruby" from the terminal and the path says: /usr/bin/ruby

so I edited the script to:
#!/usr/bin/ruby
puts "Hello, Matz!"

and I get the following error: -bash: matz.rb: command not found

So what am I missing here?

Your script is not in $PATH ?
try ./matz.rb

regards, Sandor Szücs

···

On 16.06.2009, at 16:29, Paul M. wrote:

so I edited the script to:
#!/usr/bin/ruby
puts "Hello, Matz!"

and I get the following error: -bash: matz.rb: command not found

So what am I missing here?

--

Matt Neuburg wrote:

···

Paul M. <paul.maxfield007@gmail.com> wrote:

So I'm trying to get this script to run:

So what am I missing here?

Does your script file have Unix line endings? m.

If you mean: pauls-imac:~ paulsimac$

Then the answer is yes.

my apologies, if I misunderstood your question.
--
Posted via http://www.ruby-forum.com/\.

Sandor Szücs wrote:

···

On 16.06.2009, at 16:29, Paul M. wrote:

so I edited the script to:
#!/usr/bin/ruby
puts "Hello, Matz!"

and I get the following error: -bash: matz.rb: command not found

So what am I missing here?

Your script is not in $PATH ?
try ./matz.rb

regards, Sandor
Sz�cs

Tried that, and I get: -bash: ./matz.rb: No such file or directory
--
Posted via http://www.ruby-forum.com/\.

? What does
   ls -l matz.rb
show?

···

On Tue, Jun 16, 2009 at 8:00 AM, Paul M. <paul.maxfield007@gmail.com> wrote:

> Your script is not in $PATH ?
> try ./matz.rb

Tried that, and I get: -bash: ./matz.rb: No such file or directory

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

Could you describe *exactly* what you are doing? How are you creating
and saving the script, and then what are you doing in order to run it?

m.

···

Paul M. <paul.maxfield007@gmail.com> wrote:

Matt Neuburg wrote:
> Paul M. <paul.maxfield007@gmail.com> wrote:
>
>> So I'm trying to get this script to run:
>>
>> So what am I missing here?
>
> Does your script file have Unix line endings? m.

If you mean: pauls-imac:~ paulsimac$

Then the answer is yes.

my apologies, if I misunderstood your question.

Hassan Schroeder wrote:

···

On Tue, Jun 16, 2009 at 8:00 AM, Paul M. <paul.maxfield007@gmail.com> > wrote:

> Your script is not in $PATH ?
> try ./matz.rb

Tried that, and I get: -bash: ./matz.rb: No such file or directory

? What does
   ls -l matz.rb
show?

it shows: -rwxr-xr-x@ 1 paulmaxfield staff 35 16 Jun 09:26 matz.rb
--
Posted via http://www.ruby-forum.com/\.

And have you tried each command suggested in the SAME terminal window?
Each terminal window (or rather the bash shell it invokes) have its own current work directory.

···

On Jun 16, 2009, at 7:55 PM, Matt Neuburg wrote:

Paul M. <paul.maxfield007@gmail.com> wrote:

Matt Neuburg wrote:

Paul M. <paul.maxfield007@gmail.com> wrote:

So I'm trying to get this script to run:

So what am I missing here?

Does your script file have Unix line endings? m.

If you mean: pauls-imac:~ paulsimac$

Then the answer is yes.

my apologies, if I misunderstood your question.

Could you describe *exactly* what you are doing? How are you creating
and saving the script, and then what are you doing in order to run it?

m.

----------------------------------
Skinheads are so tired of immigration, that they are going to move to a country that don't accept immigrants!
Tommy Nordgren
tommy.nordgren@comhem.se

Wow. And in that same directory,
./matz.rb
gives you a no such file or directory message?? Strange.

Try this:
od -a matz.rb

and post the result.

···

On Tue, Jun 16, 2009 at 8:28 AM, Paul M. <paul.maxfield007@gmail.com> wrote:

> ? What does
> ls -l matz.rb
> show?

it shows: -rwxr-xr-x@ 1 paulmaxfield staff 35 16 Jun 09:26 matz.rb

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

Hassan Schroeder wrote:

···

On Tue, Jun 16, 2009 at 8:28 AM, Paul M. <paul.maxfield007@gmail.com> > wrote:

> ? What does
> � �ls -l matz.rb
> show?

it shows: -rwxr-xr-x@ 1 paulmaxfield �staff �35 16 Jun 09:26 matz.rb

Wow. And in that same directory,
./matz.rb
gives you a no such file or directory message?? Strange.

Try this:
od -a matz.rb

and post the result.

Here you go:

0000000 # ! / u s r / b i n / r u b y nl
0000020 p u t s sp " H e l l o , sp M a t
0000040 z ! "
0000043
--
Posted via http://www.ruby-forum.com/\.

You might want to make sure that /usr/bin/ruby is actually there.
It might be a broken link or gimped binary. Try this test:

/usr/bin/ruby ./matz.rb

  (make sure you're rooted in the same directory as the matz.rb script
or give the full path to matz.rb). As far as I know, Leopard ships
with ruby 1.8.6 patch 87 (?), so it should be there and functioning...
  This is a pretty strange problem.

···

On Tue, Jun 16, 2009 at 9:14 AM, Paul M.<paul.maxfield007@gmail.com> wrote:

Hassan Schroeder wrote:

On Tue, Jun 16, 2009 at 8:28 AM, Paul M. <paul.maxfield007@gmail.com> >> wrote:

> ? What does
> � �ls -l matz.rb
> show?

it shows: -rwxr-xr-x@ 1 paulmaxfield �staff �35 16 Jun 09:26 matz.rb

Wow. And in that same directory,
./matz.rb
gives you a no such file or directory message?? Strange.

Try this:
od -a matz.rb

and post the result.

Here you go:

0000000 # ! / u s r / b i n / r u b y nl
0000020 p u t s sp " H e l l o , sp M a t
0000040 z ! "
0000043
--
Posted via http://www.ruby-forum.com/\.

or type:which ruby
in your bash shell... then report the results

···

2009/6/16 Phil Romero <pdromero@gmail.com>

On Tue, Jun 16, 2009 at 9:14 AM, Paul M.<paul.maxfield007@gmail.com> > wrote:
> Hassan Schroeder wrote:
>> On Tue, Jun 16, 2009 at 8:28 AM, Paul M. <paul.maxfield007@gmail.com> > >> wrote:
>>>
>>> > ? What does
>>> > � �ls -l matz.rb
>>> > show?
>>>
>>> it shows: -rwxr-xr-x@ 1 paulmaxfield �staff �35 16 Jun 09:26 matz.rb
>>
>> Wow. And in that same directory,
>> ./matz.rb
>> gives you a no such file or directory message?? Strange.
>>
>> Try this:
>> od -a matz.rb
>>
>> and post the result.
>
> Here you go:
>
> 0000000 # ! / u s r / b i n / r u b y nl
> 0000020 p u t s sp " H e l l o , sp M a t
> 0000040 z ! "
> 0000043
> --
> Posted via http://www.ruby-forum.com/\.
>
>

You might want to make sure that /usr/bin/ruby is actually there.
It might be a broken link or gimped binary. Try this test:

/usr/bin/ruby ./matz.rb

(make sure you're rooted in the same directory as the matz.rb script
or give the full path to matz.rb). As far as I know, Leopard ships
with ruby 1.8.6 patch 87 (?), so it should be there and functioning...
This is a pretty strange problem.

Phil Romero wrote:

···

On Tue, Jun 16, 2009 at 9:14 AM, Paul M.<paul.maxfield007@gmail.com> > wrote:

Wow. And in that same directory,

0000000 # ! / u s r / b i n / r u b y nl
0000020 p u t s sp " H e l l o , sp M a t
0000040 z ! "
0000043
--
Posted via http://www.ruby-forum.com/\.

  You might want to make sure that /usr/bin/ruby is actually there.
It might be a broken link or gimped binary. Try this test:

/usr/bin/ruby ./matz.rb

  (make sure you're rooted in the same directory as the matz.rb script
or give the full path to matz.rb). As far as I know, Leopard ships
with ruby 1.8.6 patch 87 (?), so it should be there and functioning...
  This is a pretty strange problem.

Problem fixed. My mistake, when I tried the ./ I was in the wrong
directory, script is working now. Thanks everyone who took time to reply
to this post, much appreciated.
--
Posted via http://www.ruby-forum.com/\.