Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: manually truncating histfile?






On 2024-12-28 10:04, Anthony Heading wrote:
I have SAVEHIST=0x4000000 to prevent the history file ever being automatically truncated before e.g. I can archive it.

What's the best way then to explicitly truncate?  If I run a (non-interactive?) shell script with SAVEHIST set to a lower value, I'm not sure what triggers a rewrite.   Alternatively I could flock the histfile and do it manually, but I'm also not sure if flock is the appropriate lock on all platforms.
I've never had any sort of issue with  that.  I backup my histfile with 'cp' and when I've changed the setting of SAVEHIST nothing breaks, but I have on occasion had to restore a histfile backup manually and again 'cp' did the job just fine.   It seems a very robust file, hard to break it.







Messages sorted by: Reverse Date, Date, Thread, Author