zsh: History is skipping commands and integers+, how to correct this?
3
votes
1
answer
216
views
Does anyone know what's occurring with zsh below and how to get the same behavior I show with
ksh
and bash
?
I'm noticing zsh
on MacOS v13.7 is skipping even commands numbers in its history output, while ksh
and bash
behave as expected. zsh
history count is also wrong, it is 6 vs 7 commands.
zsh session:
$ history
1 history
$ ls
...
$ history
2 ls
$ ls df
ls: df: No such file or directory
$ history
2 ls
4 ls df
$ ls /
$ history
2 ls
4 ls df
6 ls /
ksh and bash session:
$ ksh
$ history
1 history
$ ls
$ history
1 history
2 ls
3 history
$ ls df
$ history
1 history
2 ls
3 history
4 ls df
5 history
$ ls /
$ history
1 history
2 ls
3 history
4 ls df
5 history
6 ls /
7 history
CONFIGARTION FILES:
Keep
.common-hist (relavant):
export HISTFILE="${HOME}/.${HDIRPRE}-history.d/history-"uname -n
"-"id -nu
"-"tty|cut -c6-
""
.zshrc (relavant):
HDIRPRE="zsh"
precmd() { setprompt }
.kshrc (relavant):
HDIRPRE="ksh"
function prompt_cd {
command 'cd' "$@" && setprompt
}
alias cd="prompt_cd"
.bashrc:
HDIRPRE="bash"
PROMPT_COMMAND=setprompt
I call the function setprompt
to configure an xterm
or Apple Terminal
title bar and prompt by setting ${PS1}
. I'm not sure if that's the 'extra' command missing from zsh
history. Perhaps it's MacOS related.
Asked by atod
(155 rep)
Jan 30, 2025, 05:23 AM
Last activity: Jan 30, 2025, 08:00 AM
Last activity: Jan 30, 2025, 08:00 AM