Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shared history between bash shells version 2.05 and greater

1 view
Skip to first unread message

Vincent J Govan

unread,
Sep 6, 2005, 9:08:38 PM9/6/05
to bug-...@gnu.org
Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: aix5.1
Compiler: xlc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
-DCONF_OSTYPE='aix5.1' -DCONF_MACHTYPE='powerpc-ibm-aix5.1'
-DCONF_VENDOR='ibm' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-O2
uname output: AIX workerbee 1 5 000F224D4C00
Machine Type: powerpc-ibm-aix5.1

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
I want to acheive the feature of sharing history between shells.
e.g. type command1 in shell 1, hit <enter>
in shell 2 (to execute PROMPT_COMMAND) and up-arrow in shell 2
shows the command from shell 1.

The following in my .bashrc worked great for version 2.03
export PROMPT_COMMAND='history -a;history -n'
shopt -s histappend

Using bash v2.05 or v3.0 and the above in my .bashrc file causes
the .bash_history file to be re-appended
to with every 2nd PROMPT_COMMAND executed(See repeat by below).
The history quickly becomes unusable.

Using version 2.03, the behavior is exactly as I want, history
shared between all shells, no repeat entries.

Repeat-By:
1) add the following into your .bashrc
export PROMPT_COMMAND='history -a;history -n'
shopt -s histappend
2) start 2 fresh shells (shell 1 and shell 2)
3) in shell 1 type: echo "shell 1"<enter>
4) the echo command now shows up 1 time in .bash_history
5) in shell 2 type <enter> (the echo command still shows up only
once)
6) in shell 2 type <enter> (now the echo shows up 2 times)
7) in shell 2 type <enter><enter> (now the echo shows up 5
times)
8) shell 2 <enter><enter> (now its there 13 times)

0 new messages