Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: History file locking?



Hmm,

  I've been using the following for years (I'm currently on 2.4.333
beta)

precmd () {
        fc -nl -1 | concat $MY_HISTFILE
}

  Were concat is a simple little program which gurantees you get a lock
(via some remote server proc). Then the .zshrc does something along the
lines of:

    tail -200 $MY_HISTFILE >/tmp/g$$

    fc -R  /tmp/g$$

    /bin/rm  /tmp/g$$

    It amazing how useful a shell history stretching back for a year can
be.

   As Bart said earlier, "if you can do it with an external process, it
doesn't belong in the shell"

   Coping with locking over NFS is not a nice hole.


-- 

Daniel Dignam,                              mailto:daniel@xxxxxxxxx                    
Assemblies Development                       Phone: +44 1223-371591
EDS Unigraphics                                FAX: +44 1223-316931

          http://www-sdl.ug.eds.com/ug_assemblies.html




Messages sorted by: Reverse Date, Date, Thread, Author