mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
Merge pull request #647 from sbutler2901/master
OSX bug fix for prompt_public_ip
This commit is contained in:
commit
37a27463b8
1 changed files with 5 additions and 1 deletions
|
@ -507,7 +507,11 @@ prompt_public_ip() {
|
||||||
if [[ -f $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then
|
if [[ -f $POWERLEVEL9K_PUBLIC_IP_FILE ]]; then
|
||||||
typeset -i timediff
|
typeset -i timediff
|
||||||
# if saved IP is more than
|
# if saved IP is more than
|
||||||
timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s)))
|
if [[ "$OS" == "OSX" ]]; then
|
||||||
|
timediff=$(($(date +%s) - $(stat -f "%m" $POWERLEVEL9K_PUBLIC_IP_FILE)))
|
||||||
|
else
|
||||||
|
timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s)))
|
||||||
|
fi
|
||||||
[[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMEOUT ]] && refresh_ip=true
|
[[ $timediff -gt $POWERLEVEL9K_PUBLIC_IP_TIMEOUT ]] && 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) ]] && refresh_ip=true
|
[[ -z $(cat $POWERLEVEL9K_PUBLIC_IP_FILE) ]] && refresh_ip=true
|
||||||
|
|
Loading…
Reference in a new issue