bash


export HISTFILE=~/.history/`date +%Y%m%d`.hist
if [[ ! -e $HISTFILE ]]; then
    LASTHIST=~/.history/`ls -tr ~/.history/ | tail -1`
    if [[ -e $LASTHIST ]]; then
        tail -50 $LASTHIST > $HISTFILE
        # Write a divider to identify where the prior day's session history ends
        echo "##########################################################" >> $HISTFILE
    fi
fi
export HISTSIZE=100000

See Also:

vim