Chris Murphy wrote:
I've implemented the suggested two line change to
.bash_profile:
# User specific environment and startup programs
shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
[...]
Any thoughts?
As others have said, enabling this by default has
consequences which would make a good number of folks
unhappy, so it's probably not an ideal candidate to enable
by default.
One thing worth noting, I think, is that since bash-5.1,
PROMPT_COMMAND may be an array. This lends itself to adding
something in /etc/profile.d which appends 'history -a' to
the PROMPT_COMMAND array, e.g.:
PROMPT_COMMAND+=( history -a )
(which would grow half a dozen or so lines with the needed
checking that 'history -a' wasn't already present, that
PROMPT_COMMAND was an array instead of a string, etc.)
I don't believe that Fedora's defaults from the setup
package currently use an array, so perhaps working toward
that change would be a good first step. Once in place, a
package which provides the history appending behavior could
be easily added and those who prefer it could install it.
--
Todd