From 624fc30b0854412064616da9f527e86694235711 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 5 Sep 2019 15:21:28 +0200 Subject: zsh: improvements --- zsh/.zshrc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 032eae2..cedf300 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -29,6 +29,13 @@ zstyle '*' hosts # do not use /etc/hosts ZDIR=~/.zsh/ _HOST_TYPE=$(uname) +HOSTNAME=$(hostname -f 2>/dev/null) +if [[ $? == 0 ]]; then + echo "X" +else + HOSTNAME=$(hostname) +fi + # ############################################################################# # ssh-agent # ############################################################################# @@ -105,7 +112,7 @@ getcert () } on_gcloud () { - curl metadata.google.internal -i --connect-timeout 0.25 &>/dev/null + curl metadata.google.internal -i -m 1 &>/dev/null if [[ $? -eq 0 ]]; then echo "yes" else @@ -114,7 +121,7 @@ on_gcloud () { } on_aws () { - if [[ $(hostname -f | cut -d. -f 2) == "ec2" ]]; then + if [[ $(echo $HOSTNAME | cut -d. -f 2) == "ec2" ]]; then echo "yes" else echo "no" @@ -223,8 +230,8 @@ stty -ixon # enable mapping of C-s in vim.. autoload -U colors && colors # possible colors: black, white, green, cyan, red, yellow, magenta -case `hostname -f` in - *.local) +case $HOSTNAME in + *.local|barkley*|bogues*|bryant*|durant*|harden*|ming*|mutombo*|oneal*|robinson*) HOSTCOLOR_BG=magenta HOSTCOLOR_FG=black ;; -- cgit v1.2.3