bug-bash
[Top][All Lists]
Advanced

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

Re: A Feature Request for History


From: Sam Steingold
Subject: Re: A Feature Request for History
Date: Wed, 03 Aug 2011 11:12:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> * Chet Ramey <purg.enzrl@pnfr.rqh> [2011-06-13 15:26:27 -0400]:
>
> On 6/13/11 1:10 PM, Bradley M. Kuhn wrote:
>
>> The only feature you describe above missing with that configuration is
>> that existing shells won't find history commands written out
>> in-between.  I have a tendency to close/open bash shells, so I don't run
>> into that problem.
>> 
>> Unfortunately, having looked recently at the history code, I think
>> adding a feature whereby existing running shells "notice" the history
>> file has changed would be a large rewrite to the history code.  I think
>> that would be a useful optional feature, though.
>
> People have had success using `history -a' and `history -n' to
> accomplish this.  The idea is to append your latest command to some
> common history file, then use history -n to read other shells'
> commands into your history list.

Please add this to the bash FAQ (especially the appropriate concomitant
settings for histappend et al)!
This has been discussed in many places and various conflicting advice
has been given, including using "history -a; history -r;" which seems to
explode the history file and bash processes:
here is my current top:

29475 sds       25   0  240m 171m 1344 R 100.1  1.4  15:58.20 bash
10482 sds       25   0  231m 162m 1336 R 100.1  1.4  16:24.99 bash
24588 sds       25   0  230m 161m 1340 R 99.7  1.3  13:21.40 bash

$ gdb -p 29475
(gdb) where
#0  0x0000000000481f89 in add_history ()
#1  0x0000000000484d15 in read_history_range ()
#2  0x000000000045e0c9 in history_builtin ()
#3  0x0000000000428386 in ?? ()
#4  0x00000000004299d7 in ?? ()
#5  0x000000000042a784 in execute_command_internal ()
#6  0x000000000042caa4 in ?? ()
#7  0x000000000042a857 in execute_command_internal ()
#8  0x000000000042ba5f in execute_command ()
#9  0x000000000042ca6d in ?? ()
#10 0x000000000042a857 in execute_command_internal ()
#11 0x000000000045bd40 in parse_and_execute ()
#12 0x0000000000422fb7 in execute_variable_command ()
#13 0x000000000041b4ef in parse_command ()
#14 0x000000000041b5c6 in read_command ()
#15 0x000000000041b74e in reader_loop ()
#16 0x000000000041b2aa in main ()
(gdb) 
(same tree for all of them!)

also, is there some internal bash locking which would prevent different
bash processes from writing history at the same time?
there should be!

thanks.

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 
11.0.60900031
http://thereligionofpeace.com http://ffii.org http://camera.org
http://openvotingconsortium.org http://memri.org http://truepeace.org
I haven't lost my mind -- it's backed up on tape somewhere.




reply via email to

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