[PLUG] grep and binary file response

Russell Senior seniorr at aracnet.com
Sat Nov 26 06:58:26 UTC 2005


>>>>> "M" == M Edward (Ed) Borasky <znmeb at cesmail.net> writes:

M> ".bash_history", assuming you are currently logged on, is an open
M> file and its buffers may not have been flushed. If you are
M> interested in something in you history, use the bash "history"
M> built-in. I believe if you are *not* logged in, you can grep in
M> .bash_history and everything works just fine.

I think that is wrong.  

The ~/.bash_history file is opened, read and closed when bash starts
up, then is opened, written to and closed when bash is exiting.  It
isn't open while running.  I know that's the case with zsh (because I
hacked on its history facility *looong* ago[1]), and it appears to be
the case for bash as well, judging by its apparent behavior when I
checked just now.  One could confirm that with strace.

[1] I am even mentioned in /usr/share/doc/zsh/CONTRIBUTORS.gz

-- 
Russell Senior         ``I have nine fingers; you have ten.''
seniorr at aracnet.com



More information about the PLUG mailing list