[TUHS] PATH variable

Warren Toomey wkt at tuhs.org
Sat May 3 14:45:19 AEST 2008

On Fri, May 02, 2008 at 10:12:59PM -0600, Warner Losh wrote:
> So when did the PATH variable get introduced?

The 1e manual says: If the 1st argument represents the path name of an
executable file, it is invoked; otherwise the string "/bin/" is prepended
to the argument. In this way the standard commands, which reside in "/bin"
are found.

The 3e manual extends the above: If no such command is found,
the string "/usr" is further prepended (to give "/usr/bin/command") and
another attempt is made to execute the resulting file. (Certain "overflow"
commands live in "/usr/bin".)  If the "/usr/bin" file exists, but is not
executable, it is used by the shell as a command file.
That is to say it is executed as though it were typed from the console.

Manuals for 4e, 5e and 6e all say the above. The 7th Edition manual is
the first to say:

The shell parameter $PATH defines the search path for the directory containing
the command. Each alternative directory name is separated by a colon (:)
The default path is :/bin:/usr/bin. If the command name contains a / then the
search path is not used. Otherwise, each directory in the path is searched for
an executable file. If the file has execute permission but is not an
a.out file, it is assumed to be a file containing shell commands.


More information about the TUHS mailing list