From d9c14545b93ddeff67b82e92779c6d5a4a702252 Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Sun, 26 Jul 2009 18:12:43 +0800 Subject: Clear up code for host color. Now the color stays the same for each value of upcase_hostname in the configuration. Signed-off-by: Leonid Volnitsky --- git-prompt.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git-prompt.sh b/git-prompt.sh index 54a1690..9df71e4 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -273,16 +273,16 @@ set_shell_label() { #then host=${HOSTNAME} #host=`hostname --short` + host=${host%$default_host} + uphost=`echo ${host} | tr a-z A-Z` if [[ $upcase_hostname = "on" ]]; then - host=`echo ${host%$default_host} | tr a-z A-Z` - else - host=${host%$default_host} + host=${uphost} fi - host_color=${host}_host_color + host_color=${uphost}_host_color host_color=${!host_color} if [[ -z $host_color && -x /usr/bin/cksum ]] ; then - cksum_color_no=`echo $host | cksum | awk '{print $1%7}'` + cksum_color_no=`echo $uphost | cksum | awk '{print $1%7}'` color_index=(green yellow blue magenta cyan white) # FIXME: bw, color-256 host_color=${color_index[cksum_color_no]} fi -- cgit v1.2.3