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
HISTIGNOREis 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
historyby itself the simplest solution is to just addhistoryto the value ofHISTIGNORE.But, when
extglobis enabled (and assumingHISTIGNOREhonors it) this pattern should cover that as well: