Recently, I’ve had to juggle multiple copies of a git repo because reasons. This has inevitably led to me accidentally running commands in the terminal in the wrong copy. So, to avoid this, I’ve written a bash profile script that will set my terminal windows to different colors based on the present working directory.

Here: https://gist.github.com/kelnishi/c522a97b43ea42bc50b07b25bf824a0d

To use it, just stick it into your .bash_profile, then

Screen Shot 2019-07-22 at 1.11.07 PM.png

In whatever directory you want to color

Screen Shot 2019-07-22 at 1.12.46 PM.png

> dircolor “Some Terminal.app color profile

Screen+Shot+2019-07-22+at+1.12.57+PM.jpg

This will place a .window_color turd in that directory.

Screen Shot 2019-07-22 at 1.13.10 PM.png

Now, whenever you are under that directory, the window color will change.

You can rm .window_color to remove the turd if you no longer want to color the directory.

Posted
AuthorKelvin Nishikawa
Categoriescomputers