Passing arguments to 'env ruby' on OS X

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

When using env on the shebang line,
how to I pass arguments to Ruby under OS X?
You probably don’t

% cat w.rb
#! /usr/bin/env ruby -w

% puts “hi”

./w.rb
env: ruby -w: No such file or directory
Go and complain to Apple, it’s bug in some of the OS X core functionality
(probably BSD emulation layer). It’s the same since X.1 till X.2.6

···

On Wed, Jul 16, 2003 at 08:56:09PM +0900, Jim Freeze wrote:


Michal Suchanek
hramrach@centrum.cz

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

Hi,

#! /usr/bin/env ruby

Sorry, this should be:

#!/usr/bin/ruby

···

At Wed, 16 Jul 2003 21:29:32 +0900, nobu.nokada@softhome.net wrote:

$VERBOSE = true


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