• the most foolproof method to save all shell history

    From hput@21:1/5 to All on Sat Feb 12 20:28:49 2022
    OS=Ubuntu-21.10
    shell=Bash and more ksh93 for scripting

    I've seen a few ways described to keep your shell history of all shells
    and add it together best as can be hoped as you go.

    I had something that seemed to be working for at least a few months.

    It was plagiarized from the internet some time ago.
    Probably was at least 1.5 yrs ago.

    At some point every thing at the commented section shown below:

    ## PROMPT_COMMAND="$PROMPT_COMMAND;history -a" ; export PROMPT_COMMAND

    and a few more I don't remember and are gone from my .bashrc file now.
    (May have just been commented lines.)

    And related history stuff in .bashrc:

    HISTIGNORE='ls:cd:clear:fg:exit';export HISTIGNORE HISTCONTROL='ignoreboth';export HISTCONTROL
    HISTSIZE='30000';export HISTSIZE
    HISTFILESIZE='300000';export HISTFILESIZE
    HISTFILE=~/.bash_history;export HISTFILE

    Seemed to be working for a while anyway.

    What started happening was the PROMPT_COMMAND line and seems there were a
    few more started showing up in every command I tried to run or when
    ever a terminal was started.

    I never figured out what was doing that, tried may different
    combinations. Including stuff from google.

    After tinkering for a while and not getting it right I just commented
    it out and have just been using `shopt -s histappend'

    Maybe I'm just daydreaming, but I wonder if there are tried and tested
    ways to get the maximum possible history saved?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)