6 ms·
CDPATH is kind of obnoxious. It's confusing to have phantom subdirectories no matter where you are, which interact with auto-completion, and they can alias real
by mtdewcmu 11y ago
CDPATH is kind of obnoxious. It's confusing to have phantom subdirectories no matter where you are, which interact with auto-completion, and they can alias real subdirectories, which is always surprising and annoying when it happens. Furthermore, the autocomplete support for CDPATH directories didn't work satisfactorily.
I found a somewhat better way to use CDPATH. I made the only thing in my CDPATH a special directory into which I placed symlinks, and all of the symlinks were prefixed with an underscore. So if I wanted to jump to one of these "bookmarks," I'd start with the underscore prefix; this reduced the likelihood of them aliasing subdirectories in $PWD. I wrote shell functions to automate adding and deleting links, which automatically enforced the underscore rule. I eventually got sick of even this system and stopped using it.
My final conclusion was that CDPATH is not useful. When I want quick access to a directory, I just make a symlink in $HOME. It's not that hard to type `cd ~/symlink`, and it always does what you expect.