[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

shebang! on Leopard

Paul M.

6/16/2009 2:30:00 PM

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-....

9 Answers

matt_neuburg

6/16/2009 2:40:00 PM

0

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?

Does your script file have Unix line endings? m.

Sandor Szücs

6/16/2009 2:55:00 PM

0


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=FCcs
--




Paul M.

6/16/2009 2:59:00 PM

0

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-....

Paul M.

6/16/2009 3:01:00 PM

0

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-....

Hassan Schroeder

6/16/2009 3:12:00 PM

0

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?

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

Paul M.

6/16/2009 3:28:00 PM

0

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-....

Hassan Schroeder

6/16/2009 4:01:00 PM

0

On Tue, Jun 16, 2009 at 8:28 AM, Paul M. <paul.maxfield007@gmail.com> wrote=
:
>
> > ? What does
> > =A0 =A0ls -l matz.rb
> > show?
>
> it shows: -rwxr-xr-x@ 1 paulmaxfield =A0staff =A035 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.

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

Paul M.

6/16/2009 4:14:00 PM

0

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-....

matt_neuburg

6/16/2009 5:50:00 PM

0

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.