[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

wrapper script issue



I've started using wrapper scripts to set environment variables that are required by individual applications, as per the debian policy manual.  I've encountered a problem that seems to arise out of some difference between using the wrapper script and hitting the binary directly.  It involves a ruby script, but I don't think that matters at all.  Its probably just a common sense scripting thing.  Here's the story.  

First of all, I have wrapped my ruby binary in wrapper script as just indicated.  the wrapper script is called "ruby1.8" and here's the contents:

#!/bin/sh
export RUBYOPT=rubygems
exec /etc/alternatives/ruby1.8 "$@"

I'm trying to execute the following ruby script, matz.rb

#!/usr/bin/ruby1.8
puts "Hello, Matz!"

If I execute this script with explicit command line use of the ruby wrapper script, such as:

me@myhost:~/temp/rubyTest$ ruby1.8 matz.rb

everything works fine!

The problem arises when I try to take advantage of the shebang notation to invoke the ruby script with out explicit command line invocation of the ruby binary, ala:

me@myhost:~/temp/rubyTest$ matz.rb

results in:

./matz.rb: line 2: puts: command not found


What am I missing here?

BTW, I originally posted this to the forums.debian.net but did not receive any response.  Does this count as cross posting?  If so, I apologize.

Reply to: