On my Linux machine some of the environment variables contain lists of directories. The directories are separated by :. But sometimes they are separated by ::. Is it just a mistake that should be treated as : or it means that and empty string is one of the directories (that probably should be interpreted as the current directory).
Most of the directories specified in the environment variables have this format:
/aaa/bbb/cccHowever, some of them have this format:
/aaa/bbb//cccNote double slash between bbb and ccc. Is it just a mistake that is interpreted as a single slash or it has a special meaning?
2 Answers
The double-colon (::) does indeed mean the current directory. The Bash manual describes PATH as:
A colon-separated list of directories in which the shell looks for commands. A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon.
But personally, I think it's better to explicitly specify the current directory (e.g., /foo/bar:.) for clarity.
As for the slashes, any number of adjacent slashes is treated as a single slash.
multiple '/' separators are ignored:
$ cd .////somediris equivalent to
$ cd somedirAs for the extra separators in your PATH, a little experimentation suggests that they are also ignored.
At least, this:
/home/jon.kiparsky:2040 $ echo $PATH
/home/did not break my path! :)