That's a really cool feature of BASH. My only reservation is that this non-standard approach could lead to confusing and potentially disastrous results, especially if someone else uses your computer. I would put the exported variable in '~/.bashrc', as it's not an alias and not everyone will have a sourced '~/.bash_aliases' file. An alias is something that uses the
alias
shell builtin.
My preference is to add a
cd
alias for a given path:
Well, technically, I use functions and have aliasing completely disabled, but I used to use the above alias. I can see this
$CDPATH
feature being useful when in a Git repository, where your BASH prompt could set this parameter for when you're in a repository, allowing you to quickly jump around. Then again, the same caution as above applies here too, perhaps more so.