Unix & Linux Asked by yahnweh.remixed on December 3, 2021
I’m trying to invert or reverse the HISTORY_IGNORE parameter. Specifically trying to only include certain things in the history file, instead of selecting certain ones to exclude.
For example, if I were to only include only commands prefixed with "recordthis ", that exactly what I want.
I don’t know if there’s a way to use anything like HISTORY_INCLUDE, which doesn’t exist as far as I know. I also don’t know if there’s a way to say HISTORY_IGNORE="(*|!recordthis *)"
, which I think I tried, without desired results.
HISTORY_IGNORE
is interpreted as a zsh wildcard pattern, so provided you set the extendedglob
option, you can define
HISTORY_IGNORE='^recordthis*'
For zsh
not to save entries that don't start with recordthis
into $HISTFILE
.
^
is the negation glob operator. See also the ~
except (or and-not) operator (also requires extendedglob
):
HISTORY_IGNORE='*~recordthis*'
(ignore anything (*
) except strings starting with recordthis
).
Answered by Stéphane Chazelas on December 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP