Thread (5 messages) 5 messages, 4 authors, 2005-05-04

Re: Mercurial 0.4b vs git patchbomb benchmark

From: Rene Scharfe <hidden>
Date: 2005-05-03 17:14:19
Also in: lkml

Bill Davidsen schrieb:
On the theory that my first post got lost, why use /usr/bin/env at 
all, when bash already does that substitution? To support people who 
use other shells?

ie.: FOO=xx perl -e '$a=$ENV{FOO}; print "$a\n"'
/usr/bin/env is used in scripts in the shebang line (the very first line
of the script, starting with "#!", which denotes the interpreter to use
for that script) to make a PATH search for the real interpreter.
Some folks keep their python (or Perl, or Bash etc.) in /usr/local/bin
or in $HOME, that's why this construct is needed at all.

Changing environment variables is not the goal, insofar this usage
exploits only a side-effect of env.  It is portable in practice because
env is in /usr/bin on most modern systems.

So you could replace this first line of a bash script:

   #!/usr/bin/env python

with this:

   #!python

except that the latter doesn't work because you need to specify an
absolute path there. :]

Rene
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help