diff options
author | Amir Yalon <amiryal@git> | 2009-07-26 18:12:43 +0800 |
---|---|---|
committer | Leonid Volnitsky <leonid@volnitsky.com> | 2009-07-28 16:06:33 +0800 |
commit | d9c14545b93ddeff67b82e92779c6d5a4a702252 (patch) | |
tree | 53e1eed145a3f7218b5fc495a4502ec398e276ef | |
parent | fix to support future major Bash versions >3 (diff) | |
download | git-prompt-d9c14545b93ddeff67b82e92779c6d5a4a702252.tar.gz git-prompt-d9c14545b93ddeff67b82e92779c6d5a4a702252.tar.bz2 git-prompt-d9c14545b93ddeff67b82e92779c6d5a4a702252.zip |
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 <leonid@volnitsky.com>
-rwxr-xr-x | git-prompt.sh | 10 |
1 files 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 |