From: Stu Date: 2013-01-02T17:00:25+09:00 Subject: Re: using shebang with rvm? Wes ~ That is what I was saying. Also this is correct if you deviate from any posix syntax or use a third party language. So env would also be used for bash or zsh where bashisms( i.e. shell extension) are used but not ash. example to use bash it's the same semantically for portability if one requires bash or zsh specific syntax: #!/usr/bin/env ksh #!/usr/bin/env bash #!/usr/bin/env zsh #!/usr/bin/env fish All bourne derived shells( i.e. not csh) are backward compatible with posix sh which is a small mixture of original bourne syntax and korn syntax. The only time you would ever want to use a direct path is with a posix sh script as so: #!/bin/sh or csh ... but don't use csh =) #!/bin/csh -f If your really curious on the spec you can be read here: http://rubyprogrammer.net/~stu/posix/ You can set your path inside your interactive rc file with the $PATH variable. It's delimited with a colon and is a first positive match wins hash. If your writing a script that depends on knowing where your binaries are you can use a variable to hold the direct path to the executable or set the path variable directly inside the script. Trivial example of embedded ruby embedded inside shell: #!/bin/sh r=/path/to/mri/ruby20 $r <:'+v } s=RbConfig::CONFIG.values.grep /bin\/*sh/ puts < wrote: > Stu wrote in post #1090776: >> It's primarily for portability. Using env more or less defeats >> portability issues as every box could have ruby installed somewhere >> else. >> >> ... > > Thanks, Stu, the entire note was very helpful. > > I am not sure if you are suggesting that I should also be able to have a > non-absolute path to env command. > > Using bash on OS 10.8 I find that a she-bang for Ruby just doesn't work > unless it points to some absolute path. > > The most portable I can make a file is to say > > #! /usr/bin/env ruby > > Anyway, that approach meets my needs. > > Regards, > > Wes > ____ > > "With consistency a great soul has simply nothing to do. Speak what you > think today in hard words and tomorrow speak what tomorrow thinks in > hard words again, though it contradict everything you said today. " > > Ralph Waldo Emerson > > ____ > > > -- > Posted via http://www.ruby-forum.com/.