Re: default bash history (non)preservation

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

 



On 4/11/23 19:20, Adam Williamson wrote:

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).

Very similar to what I've been using for years, in /etc/profile.d

HISTSIZE=190000
PROMPT_COMMAND='if [ $SECONDS -gt $[${lastsavedhistory-0}+10] ]; then history -a; lastsavedhistory="$SECONDS"; fi; '"$PROMPT_COMMAND"

Regards.

--
   Roberto Ragusa    mail at robertoragusa.it
_______________________________________________
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