Hi,

At Sun, 19 Jan 2003 02:50:32 +0900,
Shashank Date wrote:
> > Also, is there a Windows equivalent of the '#!' line?
> 
> There is a notion of  "file associations" which is effectively the same
> thing. In File Explorer if you select any file with .rb extension
> 1. right click to get a pop-up
> 2. then select "Open with" you get
> 3. to "Choose" Program  to "associate" the binary which will be used to open
> this file type.

Note that redirection doesn't work with associated programs.  I
don't know this is a feature of Windows or not.

  c:\home\nobu>assoc .rb=RubyScript
  .rb=RubyScript

  c:\home\nobu>ftype RubyScript=ruby.exe %1 %*
  RubyScript=ruby.exe %1 %*

  c:\home\nobu>type foo.rb
  #!/usr/bin/ruby
  print $_ while gets

  c:\home\nobu>ruby foo.rb foo.rb
  #!/usr/bin/ruby
  print $_ while gets

  c:\home\nobu>ruby foo.rb < foo.rb
  #!/usr/bin/ruby
  print $_ while gets

  c:\home\nobu>foo.rb foo.rb
  #!/usr/bin/ruby
  print $_ while gets

  c:\home\nobu>foo.rb < foo.rb
  C:/home/nobu/foo.rb:2:in `gets': Bad file descriptor (Errno::EBADF)
          from C:/home/nobu/foo.rb:2

-- 
Nobu Nakada