$PS1 in Zsh includes this expression:
It means «if exit code of previous command (
$?) is true, show
$?, else show nothing».
This is generally useful, but one thing annoys me: shells set return code of last command to non-zero when I press Control+C without running a command! Zsh sets it to 1, Bash sets it to 130. Dash is the only shell on my system that does not reset it on Control+C.
How to reproduce:
- Launch zsh or bash.
- Press Control+C.
Is there a way to turn off this behavior on Zsh?