environ.7: Improve the description of PATH

Add more details of how PATH is used, and mention the legacy
use of an empty prefix.

Changed after a suggested patch by Bastien Roucariès.

Reported-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-01-30 08:36:08 +01:00
parent 95d690a249
commit 5cf53bcf1a
1 changed files with 16 additions and 2 deletions

View File

@ -98,8 +98,22 @@ The sequence of directory prefixes that
.BR sh (1)
and many other
programs employ when searching for an executable file that is specified
as a simple filename (containing no slashes).
The prefixes are separated by \(aq\fB:\fP\(aq.
as a simple filename (i.a., a pathname that contains no slashes).
The prefixes are separated by colons (\fB:\fP).
The list of prefixes is searched from beginning to end,
by checking the pathname formed by concatenating
a prefix, a slash, and the filename,
until a file with execute permission is found.
.IP
As a legacy feature, a zero-length prefix
(specified as two adjacent colons, or an initial or terminating colon)
is interpreted to mean the current working directory.
However, use of this feature is deprecated,
and POSIX notes that a conforming application shall use
an explicit pathname (e.g.,
.IR . )
to specify the current working directory.
.IP
(Similarly one has
.B CDPATH
used by some shells to find the target