[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: env (GNU coreutils) 5.93 patch

From: Bob Proulx
Subject: Re: env (GNU coreutils) 5.93 patch
Date: Fri, 30 Dec 2005 22:56:43 -0700
User-agent: Mutt/1.5.9i

Shigeru Makino wrote:
> For example “bash” is in if you don’t know or difference path.
> You can write follows script:
> #! /usr/bin/env bash

Yes, that is very useful for bash.  Also for perl, ruby, python too.
Because none of those are standard commands.  They are not defined by
a standard and so may not be installed in a system bin directory.
They might only be available as an add-on.  A user might have them
installed in /usr/local or even in their $HOME directory.  Therefore
using "#!/usr/bin/env command" allows command to be found on PATH,
something that #! by itself can't do.  Finding commands on PATH is
very useful and allows a script to work on systems with those
non-standard commands installed in different places without editing a
hard coded path in the calling script.

> but I try to same technique for awk script, and get err !
> #! /usr/bin/env awk -f

But awk is different because the awk command is a standard command.
It is defined by POSIX.  Therefore /usr/bin/awk is at least as well
defined and as portable as /usr/bin/env.  So with awk you don't need
to use the "/usr/bin/env awk" trick to find it on path.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]