Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: shebang problem

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?

Messages sorted by: Reverse Date, Date, Thread, Author