Chris Hulan
2/6/2008 8:16:00 PM
On Feb 5, 5:22 pm, Gerry Ford <w...@zaxfuuq.net> wrote:
> Chris Hulan wrote:
> > On Feb 4, 8:20 pm, Gerry Ford <w...@zaxfuuq.net> wrote:
> >> My second question is about the shebang line: #!
> >> I was surprised to find that it matters what's written here when using
> >> the windows platform. There is no env folder in the bin folder, so if
> >> that's a path, then it's a path to nowhere. What "should" the first
> >> line say?
> >> --
>
> > I don't think it does matter on windows.
> > To execute a ruby file (say by double-clicking) you need to have the
> > file associations
> > configured.
>
> > On *nix the shebang allows a similar function.
> > #!/usr/bin/env is not a path, it is the 'env' command in /usr/bin
> > #!/usr/bin/env ruby will find ruby on the PATH then execute it, saves
> > hard-coding the ruby path (but assumes env is in a standard location).
>
> Thanks all for responses.
>
> I do not have an 'env' command in /bin/, which is to say, when I type
> env into the dos prompt at ruby/bin/, I get "no such command" from dos.
> Maybe I'm in the wrong bin?
>
> This question appears to go to environmental variables. In the
> documentation, it suggests to type ruby -e 'puts $:' to see this
> information. As output, I get:
> C:/ruby/lib/ruby/site_ruby/1.8
> C:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
> C:/ruby/lib/ruby/site_ruby
> C:/ruby/lib/ruby/1.8
> C:/ruby/lib/ruby/1.8/i386-mswin32
env is a standard *nix command, it is not specific to ruby
You often see perl/python/shell scripts using it too.
If your on Windows it is ignored (unless your using cygwin, or
something similar?)
I don't usually out it in my scripts...