4 ms·
Does it implicitly export $CDPATH? Otherwise you would have to 'export CDPATH' to have that happen.
by pyre 16y ago
Does it implicitly export $CDPATH? Otherwise you would have to 'export CDPATH' to have that happen.
- moe 16y agoNo, it does not. But in today's world of layered environments (virtualenv, rvm) your bashrc may very well be sourced in places that you didn't anticipate. On top of that each linux distribution has its own way of screwing with the environment files in creative ways, as anyone can attest who has had to make a cronjob work across platforms... However, your question suggests that you're probably one of the chosen few who could actually use this feature safely. My general advice against it was aimed at the 99% other people who think "Oh convenient!" without being fully aware of the implications.
- telemachos 16y agoThe link I posted to suggests exporting CDPATH. I've always copied that, without really thinking about the effect on scripts. If you set (but don't export) CDPATH, it does not get passed along to scripts, as far as I can tell here. So, no, Bash doesn't implicitly export the variable. (Thanks to everyone for helping me improve my dotfiles a little bit.)