zsh-workers
 help / color / mirror / code / Atom feed
* shebang problem
@ 2006-11-25 14:06 Une Bévue
  2006-11-25 19:31 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Une Bévue @ 2006-11-25 14:06 UTC (permalink / raw)
  To: zsh-workers

Hey all,

as a shell i'm using Zsh (4.3.2) , but i'm using as script language  
Ruby (1.8.5) over Mac OS X the latest.

for ruby files i'm using this shebang :

#!/usr/bin/env ruby

then, if i do :

$ /opt/local/bin/ruby  my_script.rb <the args>

no prob at all because ruby takes control of the script

BUT if i do :

$ ./my_script.rb <the args>

zsh complains of syntax error because it attempt to read to ruby  
file, which, obviously, doesn't have the same syntax as the shell.

this morning was the first time i encountered such a prob.

someone running over a linux box (i don't know it's shell) said it's  
a known prob at least sicnce jul 2003.

does someone knows a workaround ?

the prob for me :

on my box i'm using a ruby installed under /opt (MacPort) and my  
users are using a default installed ruby under /usr

that's the reason for this shebang that way i was believing the shell  
would address the right ruby...

did you ear before about such a prob ?

a workaound ?

Yvon


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shebang problem
  2006-11-25 14:06 shebang problem Une Bévue
@ 2006-11-25 19:31 ` Bart Schaefer
  2006-11-25 20:17   ` Une Bévue
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2006-11-25 19:31 UTC (permalink / raw)
  To: zsh-workers

On Nov 25,  3:06pm, Une Bévue wrote:
}
} #!/usr/bin/env ruby
} 
} $ ./my_script.rb <the args>
} 
} zsh complains of syntax error because it attempt to read to ruby  
} file, which, obviously, doesn't have the same syntax as the shell.

I think you must be misinterpreting something about what's happening.

E.g., I made a little script that feeds itself to "cat":

schaefer[509] ./dog -n
     1  #!/usr/bin/env cat
     2  Woof woof

That seems to be working properly.

What output do you get from this:

    file -L ${^path}/ruby(N)

My suspicion is that perhaps there's another file named "ruby" somewhere
in your path that is not the executable you think it is.

} someone running over a linux box (i don't know it's shell) said it's  
} a known prob at least sicnce jul 2003.

Not that I've ever heard of before.  A known problem with ruby, perhaps?
 
} that's the reason for this shebang that way i was believing the shell  
} would address the right ruby...

The shell isn't "addressing" ruby at all when you have that #! line ...
rather, /usr/bin/env is (or should be) invoked, and then env locates
ruby and executes it.

This may appear to be a silly question, but:  Are you certain that the
"#" character is the very first character in the file?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shebang problem
  2006-11-25 19:31 ` Bart Schaefer
@ 2006-11-25 20:17   ` Une Bévue
  0 siblings, 0 replies; 3+ messages in thread
From: Une Bévue @ 2006-11-25 20:17 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]


Le 25 nov. 06 à 20:31, Bart Schaefer a écrit :

>
> My suspicion is that perhaps there's another file named "ruby"  
> somewhere
> in your path that is not the executable you think it is.
>


no, no, thanks very much for your help, in fact it is my fault.

the error message was speaking about line n° 8, obviously i had a  
look to this line and the lines above.

EXCEPT ONE : THE FIRST

my mistake was, instead of writing as shebang :

#!/usr/bin/env ruby -w

i wrote :

#/usr/bin/env ruby -w

not easy to see in a text file that the "!" is missing...

i had to do a ktrace to find that ;-)

i enjoy very much zsh anyway.

have a good week-end !

Yvon


[-- Attachment #2: Type: text/html, Size: 2008 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-25 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-25 14:06 shebang problem Une Bévue
2006-11-25 19:31 ` Bart Schaefer
2006-11-25 20:17   ` Une Bévue

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).