Notable bash $PATH behavior trivia

Kevin D. Clark kclark at CetaceanNetworks.com
Fri Jan 3 08:44:47 EST 2003


mod+gnhlug at std.com (Michael O'Donnell) writes:

> Interesting; I can't find such behavior specified
> in the man page for BASH, so I wonder where would
> such "documented" behavior actually be documented?

SUSv2 says:

# PATH 
# 
#   The sequence of path prefixes that certain functions and utilities
#   apply in searching for an executable file known only by a
#   filename. The prefixes are separated by a colon (:) When a
#   non-zero-length prefix is applied to this filename, a slash is
#   inserted between the prefix and the filename.


#   A zero-length prefix
#   is a legacy feature that indicates the current working directory. 

Here's the relevant bit  ^^^


#   It
#   appears as two adjacent colons (::), as an initial colon preceding
#   the rest of the list, or as a trailing colon following the rest of
#   the list. A portable application must use an actual pathname (such
#   as .)  to represent the current working directory in PATH. The list
#   is searched from beginning to end, applying the filename to each
#   prefix, until an executable file with the specified name and
#   appropriate execution permissions is found. If the pathname being
#   sought contains a slash, the search through the path prefixes will
#   not be performed. If the pathname begins with a slash, the specified
#   path is resolved (see pathname resolution ). If PATH is unset or is
#   set to null, the path search is implementation-dependent.


Regards,

--kevin
-- 
The monkey-boys are evil.  Lord Whorfin is supreme.




More information about the gnhlug-discuss mailing list