Is it possible to have a bash script (like a .bashrc
or .bash_profile
, basically) that is executed only upon cd’ing into a specific folder?
Answer
Add this to your ~/.bashrc
.
If .bashrc
is located in current working directory:
PROMPT_COMMAND='if [[ "$bashrc" != "$PWD" && "$PWD" != "$HOME" && -e .bashrc ]]; then bashrc="$PWD"; . .bashrc; fi'
No comments:
Post a Comment