On Mon, Aug 19, 2013 at 08:02:39PM -0700, Linda Walsh wrote: > Yes, I see what you mean. I guess I'm not real certain > as to why, if "CDPATH=~/Documents", and I type "cd Pictures/family" > and end up in ~/Documents/Pictures/family, then PATH shouldn't work > the same way.
There are several reasons. 1) PATH is used by the kernel (exec family) to determine how commands are executed. The way PATH is used by the kernel is not likely to change. Having the shell treat it differently would lead to confusion. 2) PATH is important for security. If you type ./foo then you want to run a command in the current directory, or fail. You do NOT want to run /usr/bin/./foo in the event that foo does not exist in the current working directory. If you wanted that behavior, you would have added . to your PATH and typed foo without a prefix. 3) PATH as used by the shell has decades of history behind it. Long-time shell users know how it works, and don't expect it to suddenly start working differently. This is similar to point 1.