From mboxrd@z Thu Jan 1 00:00:00 1970 From: wkt@tuhs.org (Warren Toomey) Date: Sat, 3 May 2008 14:45:19 +1000 Subject: [TUHS] PATH variable In-Reply-To: <20080502.221259.74661438.imp@bsdimp.com> References: <20080502.221259.74661438.imp@bsdimp.com> Message-ID: <20080503044519.GA43894@minnie.tuhs.org> 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. Cheers, Warren