Re: default bash history (non)preservation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-04-11 at 13:06 -0400, Chris Murphy wrote:
> 
> On Tue, Apr 11, 2023, at 12:07 PM, Adam Williamson wrote:
> 
> > I've been doing something like this for years, but I wouldn't
> > necessarily recommend it as an OOTB default. It has some interesting
> > subtleties, like the order of the command history you get when you hit
> > 'up' changes depending on when the history is updated by other
> > terminals and when the terminal you're in reloads it.
> 
> I'm not seeing this effect. While active, the shells apparently have completely unique histories, and don't interact with each other (until they're closed). From time to time I see zero length files, e.g.  .bash_history-04863.tmp appear but I don't know what they do, there's nothing in them.

The version I use is a file in /etc/profile.d that does this:

HISTSIZE=1048576
HISTFILESIZE=1048576

LAST_HISTORY_WRITE=$SECONDS
function prompt_command {
    if [ $(($SECONDS - $LAST_HISTORY_WRITE)) -gt 60 ]; then
        history -a && history -c && history -r
        LAST_HISTORY_WRITE=$SECONDS
    fi
}

PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; prompt_command"

so I guess that's the difference; mine clears and reloads the history
(if it's been more than 60 seconds since the last time it did it).
-- 
Adam Williamson (he/him/his)
Fedora QA
Fedora Chat: @adamwill:fedora.im | Mastodon: @adamw@xxxxxxxxxxxxx
https://www.happyassassin.net



_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux