Red Hat Bugzilla – Bug 1025130
Bash doesn't append to history after each command
Last modified: 2016-01-31 21:09:20 EST
Description of problem:
No commands left after switch users by "su"
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.do a fresh install on vm
2.run some commands (cd ,rpm ,yum ..)with user root
3.su lnie and run some commands
4.su root ,when type the"up"/"down"key nothing come up
(run history,only get one command ,that is :1 history
5.su lnie, the same thing happened
gnome-applet-vm is not the correct component, please re-assign
Oh, it's probably because the current session is still running and shell does not save the history yet. Don't forget that su(1) starts a new session, but does not end the previous -- see for example "ps auf".
Anyway, it's not related to su(1). Re-assigning.
still with f20-beta-RC2
still occurs with f20-final-TC1
(In reply to lnie from comment #4)
> still occurs with f20-final-TC1
Still persists in f20-final-TC5.
Really a big problem for those who used to using "up"+"down" keys,or "hostory"command ,or"ctrl+r".
It seems that the system try to remember things optionally,
for example, if I do "yum install xchat",and "yum install libvirt",it may only
able to remember doing "yum install xchat" after "su"
Hi, and thanks for the report.
I'd like to see your results of the "printenv" command (when logged in as root, ofc).
Sure,the output is attached
Created attachment 897056 [details]
Sorry for the late reply.
There are two things affecting this behaviour.
Firstly, make sure "shopt -o histappend" is somewhere in one of your bashrc files (though it should be on by default)
the behaviour you want can then be achieved by doing this (again, best to have it in your rc files somewhere):
# PROMPT_COMMAND='history -a'
With this set, do you still experience the problem?
(In reply to Ondrej Oprala from comment #9)
> Sorry for the late reply.
> There are two things affecting this behaviour.
> Firstly, make sure "shopt -o histappend" is somewhere in one of your bashrc
> files (though it should be on by default)
> the behaviour you want can then be achieved by doing this (again, best to
> have it in your rc files somewhere):
> # PROMPT_COMMAND='history -a'
> With this set, do you still experience the problem?
The problem is gone,thanks for your helpful information
Glad to hear it.