[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shared history between bash shells version 2.05 and greater

From: Vincent J Govan
Subject: shared history between bash shells version 2.05 and greater
Date: Tue, 6 Sep 2005 19:08:38 -0600

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 
uname output: AIX workerbee 1 5 000F224D4C00
Machine Type: powerpc-ibm-aix5.1

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

          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.

          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 
          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 
          8) shell 2 <enter><enter> (now its there 13 times)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]