reujab / silver

A cross-shell customizable powerline-like prompt with icons
MIT License
453 stars 30 forks source link

Bad math expression on Zsh #30

Closed sumanthratna closed 4 years ago

sumanthratna commented 4 years ago

When I open my terminal, I see:

precmd:1: bad math expression: operator expected at `N-15868274...'   

In my .zshrc, I have:

export SILVER_SHELL="zsh"

SILVER_START=$(date +%s%3N)
unsetopt prompt_subst

preexec() {
    SILVER_START=$(date +%s%3N)
}

precmd() {
    PROMPT="$(code=$? jobs=$(jobs | wc -l) cmdtime=$(($(date +%s%3N)-$SILVER_START)) silver print "${SILVER[@]}") "
    SILVER_START=$(date +%s%3N)
}

If I change the date in cmdtime to gdate, I just get:

precmd:1: bad math expression: operator expected at `N'

zsh 5.7.1 (x86_64-apple-darwin19.0) on macOS 10.15.5 Beta

ghost commented 4 years ago

You need to add an alias. alias date=gdate

sumanthratna commented 4 years ago

Not sure how I missed that, I remember seeing it in the documentation. Thanks!