|
Bugzilla – Full Text Bug Listing |
| Summary: | zsh precmd breaks history | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE Tumbleweed | Reporter: | greg mott <novell> |
| Component: | Other | Assignee: | Paolo Perego <paolo.perego> |
| Status: | NEW --- | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | ||
| Version: | Current | ||
| Target Milestone: | --- | ||
| Hardware: | x86-64 | ||
| OS: | openSUSE Tumbleweed | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Bug Depends on: | |||
| Bug Blocks: | 1217304 | ||
well the above still looks like a bug, but meanwhile what i really wanted turns out to be "print -s", and this doesnt break history:
HISTTIMEFORMAT="%F%a%T "
if [ $ZSH_NAME ]
then emulate -R sh
setopt extendedhistory
else shopt -s histappend
fi
hshead(){ $HS ===header $WINDOW $SUDO_USER;}
precmd(){ [[ $WINDo = $WINDOW ]]||{ WINDo=$WINDOW;hshead;};} #new window?
if [ $ZSH_NAME ]
then HS=print\ -s
else HS=history\ -s
fi
|
The below as either .zshrc or .bashrc inserts a header at the top of the history of every shell session. in bash it's silent on standard out as desired and the header inserts before the first command of each session. in zsh the header appears both on standard out and in the history *after* the first command of the session. Changing "preexec" to "precmd" seems like it ought to put the header before the first command of the session. But instead it breaks history, nothing appears in history. Looks like a bug.. HISTTIMEFORMAT="%F%a%T " if [ $ZSH_NAME ] then emulate -R sh #whether or not history breaks is consistent whether both, setopt extendedhistory #either, or neither of the emulate&setopt commands are included else shopt -s histappend fi HIShead(){ echo ===header $WINDOW $SUDO_USER;} HISTwin(){ [[ $WINDo = $WINDOW ]]||{ WINDo=$WINDOW;HISneww;};} if [ $ZSH_NAME ] then #precmd(){ HISTwin;} #breaks history preexec(){ HISTwin;} #inserts header after not before first command HISneww(){ fc -eHISplic;} HISplic(){ echo \#$(HIShead)>|$1;} #zsh, insert a header whenever WINDOW is new else HISneww(){ history -s $(HIShead);} #bash, same PROMPT_COMMAND=HISTwin fi