reujab / silver

A cross-shell customizable powerline-like prompt with icons

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad math expression on Zsh

sumanthratna opened this issue · comments

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

You need to add an alias. alias date=gdate

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