fixed issue with POWERLEVEL9K_PUBLIC_IP_NONE being empty for real

pull/22/head
rjorgenson 8 years ago
parent f33f843e92
commit f11ca0664c

@ -429,7 +429,7 @@ prompt_battery() {
prompt_public_ip() { prompt_public_ip() {
# set default values for segment # set default values for segment
set_default POWERLEVEL9K_PUBLIC_IP_TIMOUT "300" set_default POWERLEVEL9K_PUBLIC_IP_TIMOUT "300"
set_default POWERLEVEL9K_PUBLIC_IP_NONE "" set_default POWERLEVEL9K_PUBLIC_IP_NONE "none"
set_default POWERLEVEL9K_PUBLIC_IP_FILE "/tmp/p9k_public_ip" set_default POWERLEVEL9K_PUBLIC_IP_FILE "/tmp/p9k_public_ip"
set_default POWERLEVEL9K_PUBLIC_IP_HOST "http://ident.me" set_default POWERLEVEL9K_PUBLIC_IP_HOST "http://ident.me"
@ -441,7 +441,7 @@ prompt_public_ip() {
timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s))) timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s)))
[[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMOUT ]] && refresh_ip=true [[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMOUT ]] && refresh_ip=true
# If tmp file is empty get a fresh IP # If tmp file is empty get a fresh IP
[[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) || $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) =~ '$POWERLEVEL9K_PUBLIC_IP_NONE' ]] && refresh_ip=true [[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) || $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) =~ "$POWERLEVEL9K_PUBLIC_IP_NONE" ]] && refresh_ip=true
else else
touch $POWERLEVEL9K_PUBLIC_IP_FILE && refresh_ip=true touch $POWERLEVEL9K_PUBLIC_IP_FILE && refresh_ip=true
fi fi

Loading…
Cancel
Save