Chet Ramey <chet@nike.ins.cwru.edu> wrote:
>> And is "history -n" very intelligent?
>
> Define `very intelligent'.
Intelligent enough to make "history -n; history -a" work in
PROMPT_COMMAND, so that duplicates don't show up when two shells are
running concurrently, and so that things don't get very much out of
chronological order. Then those shells would share a single history
list, which is what Keith is after, right?
> It keeps track of how many lines it thinks are in the history file
> and reads any lines after that one into the history list.
Does that also reset the number of history lines in the current
session, so that the just-read lines aren't re-appended with
"history -a"?
>> Would it work to put "history -n; history -a" in $PROMPT_COMMAND?
>
> You'd probably kill your disk doing it.
func() {
local HISTFILE=file_on_ramdisk
history -n
history -a
}
PROMPT_COMMAND=func
paul