What would be the correct pattern for ignoring commands such as:
history 10
history 104
history .. #whatever may be the number here
I tried:
HISTIGNORE='history\s+\d*'
but that doesn't work.
What would be the correct pattern for ignoring commands such as:
history 10
history 104
history .. #whatever may be the number here
I tried:
HISTIGNORE='history\s+\d*'
but that doesn't work.
The value of
HISTIGNORE
is a list of shell patterns. Not a list of regular expressions. As such the regular expressions will not work.This pattern
'history *[0-9]*'
should do what is needed here.Edit: Pulling in added information from the comments.
To also ignore
history
by itself the simplest solution is to just addhistory
to the value ofHISTIGNORE
.But, when
extglob
is enabled (and assumingHISTIGNORE
honors it) this pattern should cover that as well: