Skip to content

Instantly share code, notes, and snippets.

@mrosset
Created February 22, 2011 17:37
Show Gist options
  • Save mrosset/839032 to your computer and use it in GitHub Desktop.
Save mrosset/839032 to your computer and use it in GitHub Desktop.
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
}
@mrosset
Copy link
Author

mrosset commented Feb 23, 2011

I rather it not be random I can tell quickly by the host color what host I am on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment