The Bourne Again shell manual says, of cd dir:
[…] each directory name inCDPATHis searched for dir. […] If dir begins with a slash (/), thenCDPATHis not used.
The Z shell manual says, of cd arg:
Otherwise, if arg begins with a slash, attempt to change to the directory given by arg.If arg does not begin with a slash, the behaviour depends on whether the current directory
.occurs in the list of directories contained in the shell parametercdpath. […] If.occurs incdpath, thencdpathis searched strictly in order so that.is only tried at the appropriate point.
The POSIX Ordinary shell manual says, of CDPATH:
Works the same way asPATHfor those directories not beginning with/incdcommands.
The Debian Almquist shell manual says, of cd:
If […] the shell variableCDPATHis set and the directory name does not begin with a slash, then the directories listed inCDPATHwill be searched for the specified directory.
The '93 Korn shell manual says, of cd arg:
If arg begins with a / then the search path is not used. Otherwise, each directory in the path is searched for arg.
The MirBSD Korn shell manual says, of CDPATH:
It works the same way asPATHfor those directories not beginning with/incdcommands.
With the single exception of the '93 Korn shell, none of these are actually the case:
% export CDPATH=/tmp: % mkdir wibble /tmp/wibble % ksh93 -c 'cd ./wibble' /tmp/wibble % dash -c 'cd ./wibble ; pwd' /home/JdeBP/wibble % bash -c 'cd ./wibble ; pwd' /home/JdeBP/wibble % mksh -c 'cd ./wibble ; pwd' /home/JdeBP/wibble % lksh -c 'cd ./wibble ; pwd' /home/JdeBP/wibble % posh -c 'cd ./wibble ; pwd' /home/JdeBP/wibble % zsh -c 'cd ./wibble ; pwd' /home/JdeBP/wibble %
/tmp/./wibble exists and is a directory, but only the '93 Korn shell is searching CDPATH and finding it. The rest are not.
Why not?
CDPATH=/tmp ksh -c 'cd ..'does not cd to/tmp/..(while it does for go to /tmp/. forcd .)cd .or..would not consider CDPATH, still not documented (except with comments in the code as seen in ksh86 source code).