On 2023/03/10 11:16:31 +0000, s...@disroot.org wrote:
> I believe since the given directory (argument) is not an absolute path; 
> it attempts to search in CDPATH before checking if the directory 
> exists. This will cause any attempts to cd into a directory to fail.
> 
> 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.

Agreed.  I've been bitten by this too, and I've "fixed" it by
explicitly listing "." in front of CDPATH:

% echo $CDPATH
.:/home/op/w:/usr/ports:/usr/ports/mystuff:/home/op/quicklisp/local-projects

To be fair I've not checked how other shells handle CDPATH nor if
something is specified by POSIX in this regard, but adding "." in
front doesn't seem such a bad workaround.

HTH

Reply via email to