When using env on the shebang line,
how to I pass arguments to Ruby under OS X?
Doing the following gives me an error on OS X, but
works on FreeBSD and Sun:
% cat w.rb
#! /usr/bin/env ruby -w
% puts “hi”
./w.rb
env: ruby -w: No such file or directory
···
–
Jim Freeze
Hi,
When using env on the shebang line,
how to I pass arguments to Ruby under OS X?
#! /usr/bin/env ruby
$VERBOSE = true
Or you can use /bin/sh instead of /usr/bin/env.
#!/bin/sh
-- ruby --
exec ruby -wx “$0” “$@”
#!ruby
···
At Wed, 16 Jul 2003 20:56:09 +0900, Jim Freeze wrote:
–
Nobu Nakada
Will this work if I run “ruby myscript.rb” on a Windows box?
If not, is it possible to make that case work?
Paul
···
On Wed, Jul 16, 2003 at 09:29:32PM +0900, nobu.nokada@softhome.net wrote:
#!/bin/sh
-- ruby --
exec ruby -wx “$0” “$@”
#!ruby
Hi,
#!/bin/sh
-- ruby --
exec ruby -wx “$0” “$@”
#!ruby
Will this work if I run “ruby myscript.rb” on a Windows box?
Do you mean whether it works as a script directly?
#! /bin/sh
-- ruby -- # just for editors
|| ‘eval’ ‘exec ruby -wx “$0” “$@”’
#!ruby
puts “hi”
If not, is it possible to make that case work?
If you want a way to make a batch file from a script, look at
“ruby_bin_dosish” portion in instruby.rb.
I don’t guess it is possible to merge ruby/shell/batch.
···
At Wed, 16 Jul 2003 22:47:50 +0900, Paul Brannan wrote:
–
Nobu Nakada