4 ms·
For bash, and maybe zsh, I use this in a profile.d script to log history output. HISTTIMEFORMAT=“%F %T $(logname) $(pwd) “ if [ ! -d $HOME/.history ]
by j33zusjuice 4y ago
For bash, and maybe zsh, I use this in a profile.d script to log history output.
HISTTIMEFORMAT=“%F %T $(logname) $(pwd) “
if [ ! -d $HOME/.history ]
then mkdir -p $HOME/.history
fi
PROMPT_COMMAND=‘echo “$(history 1)” >> $HOME/.history/$(date “+%F”)
fi
export PROMPT_COMMAND
I suppose adding `readonly PROMPT_COMMAND` would be a good idea so no one overwrites it, but most people wouldn’t even think to look for it.
I don’t think this would do much for handling screen history, though.