[katello-devel] Why #!/usr/bin/env ?

Ewoud Kohl van Wijngaarden ewoud+katello at kohlvanwijngaarden.nl
Mon Jul 23 20:06:31 UTC 2012


On Mon, Jul 23, 2012 at 03:37:43PM -0400, Jordan OMara wrote:
> On 23/07/12 21:35 +0200, Miroslav Suchy wrote:
> >Why do you guys prefer #!/usr/bin/env ?
> >
> >I seen it twice in today pull requests and git grep show me it is
> >used several times in our code.
> >
> >I understand it may put in game e.g /usr/local/bin/ with locally
> >compiled python/ruby. But is it what we want? Do we guarantee,
> >that our code will work with locally modified version of
> >python/ruby?
> >
> >I always used plain #!/usr/bin/python or #!/usr/bin/ruby as it
> >gives me more control and less bug reports.
> >
> >Mirek
> >
>
> I actually had a stranger from the internet make a pull request on one
> of my random github projects and correct a ruby script from
> #!/usr/bin/ruby -> #!/usr/bin/env ruby ; the same way we have it in
> our scripts. I'm curious as well

Can't speak for ruby, but in the python world virtualenv[1] is popular
among developers. Then python can live in ~/myenv/bin/python as well as
many dependencies under ~/myenv/lib/python2.X/site-packages which
/usr/bin/python will never find, or worse, different versions. I imagine
something similar may exist in the ruby world.

Btw, those who like virtualenv will also like virtualenvwrapper
which makes it easy to manage many environments.

[1]: http://pypi.python.org/pypi/virtualenv/
[2]: http://www.doughellmann.com/projects/virtualenvwrapper/




More information about the katello-devel mailing list