I have noticed a strange behavior when working with bash "history" command.
Every command in history has its index, and I expected that clearing
history should reset this index to zero. However, running history -c
actually decrements this index by HISTSIZE, so that following commands will
not be numbered from 1.
This can happen e.g. when you set HISTFILESIZE to a bigger value than
HISTSIZE. In that case running "history -c; history -r" repeatedly will
keep incrementing command indices, while I think it should not.
I've checked out the source, but quick reading didn't reveal any reasoning
behind this. Seems like a bug to me. Is this desired?
$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)