> I also believe that the given directory to cd should be preferred over > CDPATH; what i mean by this is if a directory exists within CDPATH but > also exists within the current working directory; the latter should be > preferred.
I haven't checked how other shells behave. This is the documented behavior: CDPATH Search path for the cd built-in command. It works the same way as PATH for those directories not beginning with ‘/’ or ‘.’ in cd commands. Note that if CDPATH is set and does not contain ‘.’ or an empty path, the current directory is not searched. So setting CDPATH=:/tmp or CDPATH=.:/tmp will work as expected. > This is my first time submitting to a mailing list, so my apologies if > i get something wrong. It was perfectly clear and well done. Thanks.