From: "D. Deryl Downey" Date: 2012-12-27T15:29:25+09:00 Subject: Re: using shebang with rvm? Of course, because you use a FULL path. By not using #!/usr/bin/env ruby (notice the /usr/bin/env part) you're specifically calling a specific ruby which bypasses ALL environment variables and uses the direct binary. No one told you to use #!/usr/bin/ruby. They said #!/usr/bin/env ruby which tells the script to query the path for the first ruby found and use its environment vars, and to make its exit code status be the return value of the script itself, when its done executing. (See man env) -- D. Deryl Downey "The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice. On Dec 27, 2012, at 1:23 AM, Wesley Rishel wrote: > Thanks, but most shebang files I have seen include an absolute path to > the language interpreter. Rvm does not intervene when the shell is > interpreting a script containing a shebang. So, for example, if you > create this script on OS 10.8 it returns 1.8.7 no matter what version > you have selected in rvm. > > $ cat tryshbang.rb > #! /usr/bin/ruby > puts RUBY_VERSION > $ ./tryshbang.rb > 1.8.7 > $ > > I have since found the following recommendation in the Wikipedia article > on shebang: http://en.wikipedia.org/wiki/Shebang_(Unix) > > #! /usr/bin/env ruby > puts RUBY_VERSION > > It works. > > -- > Posted via http://www.ruby-forum.com/. >