Created
February 22, 2011 17:37
-
-
Save mrosset/839032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt_colors { | |
if [ -f /bin/tput ] || [ -f /usr/bin/tput ] ; | |
then | |
black=$(tput setaf 0) | |
red=$(tput setaf 1) | |
green=$(tput setaf 2) | |
yellow=$(tput setaf 3) | |
blue=$(tput setaf 4) | |
magenta=$(tput setaf 5) | |
cyan=$(tput setaf 6) | |
white=$(tput setaf 7) | |
reset=$(tput sgr0) | |
cksum_color_no=$(echo $HOSTNAME | cksum | awk '{print $1%7}') | |
color_index=($green $yellow $blue $magenta $cyan $white) | |
host_color=${color_index[$cksum_color_no]} | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I rather it not be random I can tell quickly by the host color what host I am on.