Robert Klemme
10/5/2004 2:28:00 PM
<Ara.T.Howard@noaa.gov> schrieb im Newsbeitrag
news:Pine.LNX.4.60.0410050756510.7297@harp.ngdc.noaa.gov...
> On Tue, 5 Oct 2004, Robert Klemme wrote:
>
> > Personally I don't understand why pople use the "#!/usr/bin/env ruby"
idiom
> > anyway. AFAIK using the real path to the ruby interpreter is a) more
> > efficient and b) more secure. So why use env? Did I miss something?
>
> many of my scripts are run from 30-40 machines. some of the machines
mount a
> central nfs server on which i've installed ruby and all required
packages for
> my software. however, as an optimization and to improve nfs failure
tolerance
> many of our machine cache a lot of software (including ruby) and data
files
> further up the path than the nfs ruby. finally, a third class of
machines has
> the system ruby only (1.6.8). if i write a script and use
>
> #!/usr/bin/env ruby
>
> the system finds the 'right' ruby at run time. without this i'd have to
> maintain many copies of my scripts. this problem extends to the
situation
> where i give you a ruby script and don't know where your ruby is, and to
> upgrading ruby (i have 1.8.1 before 1.8.2 in our group path because i'm
> migrating to 1.8.2, but reverse this for testing). env helps with all
of this
> and, yes, it's probably less secure - but so is anything that involves
getting
> alot of work done quickly ;-)
Sure enough. But what's the advantage over
#!ruby
Are there shells that don't allow this? Does env search not only $PATH
but elsewhere?
Kind regards
robert