You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
When using the prompt-part 'public_ip' the first display is ok (it will refresh the IP and cache in /tmp/p9k_public_ip). The second time the theme will stat -f "%m" /tmp/p9k_public_ip to find the last-modified stamp. On macOS with GNU CoreUtils installed, this will fail.
prompt_public_ip:15: bad math expression: operand expected at `"/tmp/p9k_...'
Have you tried to debug or fix it?
disabling the stat -f version and using the date -r version solves the problem
in function prompt_public_ip: 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
or if [[ "$OS" == "OSX" ]] && [[ "gnubin" != "$(basename $(dirname $(which stat)))" ]]; then timediff=$(($(date +%s) - $(stat -f "%m" $POWERLEVEL9K_PUBLIC_IP_FILE))) else timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s))) fi
this last one tests stat for being in the gnubin subfolder, but I doubt this is universal over all macOS version and/or brew versions and/or coreutils versions
I know this is is a one in thousands situation, but at least now it is known and people with the same problem know how to fix it :)
Environment Information
This information will help us understand your configuration.
What version of ZSH are you using? You can use zsh --version to see this.
zsh 5.7.1 (x86_64-apple-darwin19.0)
Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)?
Oh-My-ZSH
How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)?
git clone
What version of P9k are you using?
v0.6.7
Which terminal emulator do you use?
macOS built-in Terminal.app
GNU CoreUtils installed with brew install coreutils $ which stat /usr/local/opt/coreutils/libexec/gnubin/stat
The text was updated successfully, but these errors were encountered:
Describe Your Issue
When using the prompt-part 'public_ip' the first display is ok (it will refresh the IP and cache in /tmp/p9k_public_ip). The second time the theme will
stat -f "%m" /tmp/p9k_public_ip
to find the last-modified stamp. On macOS with GNU CoreUtils installed, this will fail.Have you tried to debug or fix it?
disabling the
stat -f
version and using thedate -r
version solves the problemin function prompt_public_ip:
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
becomes
#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
or
if [[ "$OS" == "OSX" ]] && [[ "gnubin" != "$(basename $(dirname $(which stat)))" ]]; then
timediff=$(($(date +%s) - $(stat -f "%m" $POWERLEVEL9K_PUBLIC_IP_FILE)))
else
timediff=$(($(date +%s) - $(date -r $POWERLEVEL9K_PUBLIC_IP_FILE +%s)))
fi
this last one tests stat for being in the
gnubin
subfolder, but I doubt this is universal over all macOS version and/or brew versions and/or coreutils versionsI know this is is a one in thousands situation, but at least now it is known and people with the same problem know how to fix it :)
Environment Information
This information will help us understand your configuration.
zsh --version
to see this.zsh 5.7.1 (x86_64-apple-darwin19.0)
Oh-My-ZSH
git clone
v0.6.7
macOS built-in Terminal.app
GNU CoreUtils installed with
brew install coreutils
$ which stat
/usr/local/opt/coreutils/libexec/gnubin/stat
The text was updated successfully, but these errors were encountered: