Bad math expression on Zsh
sumanthratna opened this issue · comments
Sumanth Ratna commented
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
Deleted user commented
You need to add an alias. alias date=gdate
Sumanth Ratna commented
Not sure how I missed that, I remember seeing it in the documentation. Thanks!