On Sun, 2008-02-03 at 06:25 +0900, Christian R. wrote:
/usr/bin/env ruby (without the -w switch)
in my programs? Is there any way to delimit these args so that env sees
them as 2 args instead of one whole string?
In short, you’re hosed in regards to that particular method.
Unless I’m mistaken, the shebang line is interpreted by the kernel, and
on Linux it only accepts one parameter to the interpreter the line
defines - so #!/usr/bin/env ruby -w will always call /usr/bin/env with
the parameter “ruby -w”, which is not a valid command. There’s no way
If, however, all you need this for is the -w switch to turn on warnings,
just don’t do that with a switch to the ruby binary and use the $VERBOSE
global variable to turn warnings on and off. The manpage for ruby even
hints to this:
-w Enables verbose mode without printing version message at
the beginning. It sets the $VERBOSE variable to true.
That solution should be more portable.