I'm looking to setup visual alerts when working within certain directories within mac osx terminal.
Specifically, I have several projects running within the same framework which can easily lead to mistakes. I end up running a pwd
before other commands if I've been away for the terminal windows for more than a few moments. Seems like a dumb extra step.
All resources I've found are just about setting up color profiles in my bash profile :(
UPDATED Here is the answer so far (does bark a note, doesn't work for color). Read below for why.
#! /bin/bash -i
# Add this to ~/.bash_profile
# PROMPT_COMMAND=/usr/local/bin/coloraware
PROJECT1='projectfolder/'
PROJECT2='projectfolder2/'
PROJECT3='projectfolder3/'
PWD=`pwd`
case "$PWD/" in
*$PROJECT1*)
export PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
echo "Project #1"
;;
*$PROJECT2*)
export PS1='\[\e[1;34m\][\u@\h \W]\$\[\e[0m\] '
echo "Project #2"
;;
*$PROJECT3*)
export PS1='\[\e[1;35m\][\u@\h \W]\$\[\e[0m\] '
echo "Project #3"
;;
esac