bash History on F7

Bill Davidsen davidsen at tmr.com
Tue Oct 30 20:33:48 UTC 2007


Adel ESSAFI wrote:
> Dear All
> I have a strange behaviour on my bash shell on F7. In some session, I 
> lose all the histoty!!! I don t find any command that I have executed in 
> my previous sessions.
> Regards.
> Adel
> 
 From my custom /etc/profile:

# reconfigure the history file
#       prevents multiple logins to the same id from clashing
#       thought to work for bash and ksh
#================================================================
if [ -n "$HISTFILE" ]; then
   hdir=${HISTFILE%/*}
   hfile=${HISTFILE##*/}
   nfile=$(tty); nfile=.sh_hist_${nfile##*/}
   if [ "$hfile" != "$nfile" ]; then
     ( cd $hdir && touch $hfile && mv $hfile $nfile ) &&
       HISTFILE=${hdir}/${nfile}
   fi
   unset hdir hfile nfile
fi

Note, this was written in 1990 or so, when ksh was a very new toy. It 
has been working untouched for about 15 years, and the only thing 
changed is that on exit I now shred, purge, or at least delete the file 
for security. The world is a scarier place now. :-(

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the fedora-list mailing list