what is an environment variable?
Robert P. J. Day
rpjday at crashcourse.ca
Sat Mar 17 00:21:20 UTC 2012
On Fri, 16 Mar 2012, Smoot Carl-Mitchell wrote:
> On Fri, 2012-03-16 at 23:03 +0000, Thufir Hawat wrote:
> > I've looked at
> > https://help.ubuntu.com/community/EnvironmentVariables and some
> > other resources, but it's still unclear to me *what* $PATH is.
> > There's no corresponding file, just various files which add to the
> > this variable. (It's a shell variable?)
>
> PATH is an exported shell variable. So it shows up as part of the
> environment in a forked process.
just my $0.02, but i like to avoid PATH being part of the
*environment*. it's obviously a useful *shell* variable but, if you
think about it, its value is to locate commands based on how
complicated you want to make your search path.
*however*, once the command is located, it's generally safer if
*those* commands use a standard search path, and not your overly
complicated one. that's why you see so many people who, at the top
of their shell scripts, have a line like:
PATH=/bin:/usr/bin:/usr/local/bin
it's specifically to avoid having a shell script having to deal with
an arbitrarily insane setting of PATH based on who invokes it.
or is there some compelling reason to export PATH that i'm missing?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the ubuntu-users
mailing list