SPUG: she-bang lines: "/usr/bin/perl" vs "/usr/bin/env perl"
tcaine at cac.washington.edu
tcaine at cac.washington.edu
Fri Apr 13 15:36:06 PDT 2007
/usr/bin/env will search your PATH for perl. If I download a script that
has the "#!/usr/bin/env perl" she-bang line and my perl is located at
/usr/local/bin/perl and /usr/local/bin is in my path then the script
should still work without needing to modify the she-bang line.
I still prefer the #!/usr/bin/perl she-bang line myself, as not all env
exucutables live in /usr/bin anyways (athough it usually does) and if you
have more than one version of perl in your PATH you get the first one env
finds, which may not be the one you expect.
On Fri, 13 Apr 2007, Michael R. Wolf wrote:
>
> I'm familiar with this one:
> #! /usr/bin/perl
>
> I've seen this one, but can't think of why it would be better:
> #! /usr/bin/env perl
>
>
> Ideas?
>
> Michael
>
> P.S. The "Hello World" code bubbles use the second form. I'm curious why.
>
> --
> Michael R. Wolf
> All mammals learn by playing!
> MichaelRWolf at att.net
>
More information about the spug-list
mailing list