[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
history -c doesn't reset command counter properly
From: |
Janek Warchoł |
Subject: |
history -c doesn't reset command counter properly |
Date: |
Sat, 10 Mar 2018 14:27:07 +0100 |
Hello,
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?
best,
Janek
PS
$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
- history -c doesn't reset command counter properly,
Janek Warchoł <=