Re:Production is Red, Development is Blue
by CWIZO on Monday January 10, 2011 @03:12PM
(#2089577)
Is there any way to set this on directory level? I do my development in my /home/XYZ folder, and production is in /usr/local/www/XYZ and it would be great if I could set the background to red in the production dir (if I happen to wander into it somehow (which I really almost never do)).
[ Parent
| on HN ]
You could put a shell script around cd that checks the current working directory every time you cd and alerts you appropriately.
A little clunky, I'll admit. I'd like to hear any more graceful solutions.
From man bash, the variable PROMPT_COMMAND:
If set, the value is executed as a command prior to issuing each primary prompt.
e.g.: PROMPT_COMMAND='[[ "$PWD" =~ ^/sensitive/area ]] && PS1="be careful: " || PS1="normalprompt: "'