Apache Web-Serving with Mac OS X: Part 2
Subject:   PATH Environment Variable from printenv
Date:   2002-04-16 17:00:20
From:   morbus
Response to: PATH Environment Variable from printenv

The PATH can roughly be stated as "anytime I run a program, I'll look for it in my PATH". So say, for example, that you write a perl script that uses the "grep" command. Because your PATH is set to /usr/bin OR /bin OR /Users/morbus, you can simply say "grep [command line flags]" in your perl script.

If, on the other hand, grep was not in either of those three directories, than you'd have to specify it's full path, like, for example: "/usr/local/sbin/grep [command line flags]". The PATH is set via environment variables - any time you log into the Terminal, a PATH is magically set. It allows you to say stuff like "perl" as opposed to "/usr/bin/perl/".

As for the /Users/morbus showing up in the path, it's pretty normal. PATH's automatically are defined with common directories (like /usr/bin and /bin), but very often, they define the current user's home directory as part of the PATH as well. It's nothing you'd really be worried about (although, you CAN override the PATH in your perl scripts - this will affect the perl script only, not the generic PATH of your webserver).