3 ms·
Many years ago I discovered CDPATH, and months later, I determined, never again will I walk into that valley of madness. It breaks so many things.
by mceachen 7y ago
Many years ago I discovered CDPATH, and months later, I determined, never again will I walk into that valley of madness. It breaks so many things.
- everybodyknows 7y agoFor quick directory switching, consider the alternative approach of the built-in directory stack commands: dirs, pushd, popd. A bit of scripting is then wanted to coerce the output of 'dirs' into a readable format.
- kekebo 7y agoOr some directory bookmarking functionality like ohmyzsh's jump plugin or fasd[0] https://github.com/clvv/fasd https://github.com/clvv/fasd
- mceachen 7y agoNice. I actually KISSed and just added a bunch of aliases that start with 'cd' to hop into common directories, like alias cdp='cd ~/src/photostructure' for example. I found I only really needed < 10 directories aliases in this fashion.
- everybodyknows 7y agoTo tidy up dirs's output: d () { dirs -p | nl -v 0; } The numbers in the left-hand column correspond to offsets from top-of-stack. So, if you see $ d 0 ~ 1 /var/log/apt to switch back to /var/log/apt, you could type: $ pushd +1