8

I'm on ubuntu 10.4 and my shell is bash. When I open several gnome terminals and close them history is properly appended. When I enter shopt it says among other things:

histappend      off

Can anyone tell me where the append behaviour is configured?

4
  • 1
    retagging 'ubuntu-10.04-lts' since ubuntu-10.10 isn't out yet. tho i hear it's to be named something Meerkat. May 1 '10 at 17:40
  • 1
    btw, my bash shells on Lucid all show histappend as on ... no tweaks yet ... have you tweaked your bash configuration already? May 1 '10 at 17:45
  • @quack: Thanks, I'm ahead of my time, as always;-) May 7 '10 at 3:45
  • @quack: I have upgraded this install several times, so I'm not 100% sure. For me it doesn't matter if histappend is on or off, history is always appended. What I'm really curious about is why this happens? It would be insightful, if you could shopt -u histappend and tell me if it is still appended in your install? May 7 '10 at 3:51
1

histappend is the setting I would expect to control this. Since those aren't login shells, it won't be something going on in /etc/bash.bash.logout or ~/.bash_logout. Check to see if a trap is set by entering trap -p. Also do echo $PROMPT_COMMAND to see if something is going on there.

1
  • echo $PROMPT_COMMAND returns echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007". trap -p returns nothing. I have no /etc/bash.logout and ~/.bash_logout contains nothing regaring history. May 1 '10 at 14:35
1

bash tries to append history as much as possible. With histappend on, you will guarantee always appending history. If it is off, history will still be appended only until the number of commands you Enter in a interactive bash session > HISTSIZE. When this happens, history will be overwritten.

If you want to explicitly overwrite history, you can use history -w in .bash_logout or an exit trap.

I posted in more detail in this answer about how bash history append works.

-1

I wrote a quick tip about setting histappend this on my site but I will paraphrase the post here, to answer your question, I hope.

You should be able to configure histappend to be 'on' by using shopt.

To enable run

shopt -s histappend

To disable run

shopt -u histappend

Does that help?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.