Tuesday 27 November 2018

macos - Is there a folder-specific .bashrc or .bash_profile?


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

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...