[NTLUG:Discuss] HOW? bash shell shortcut using history |grep

MadHat madhat at unspecific.com
Thu Jun 7 12:29:32 CDT 2001


At 11:53 AM 6/7/2001 -0500, you wrote:
>At 08:46 AM 6/7/2001 -0500, you wrote:
>>Something that has always puzzled me about the shell history
>>file:   If a user is logged in on multiple tty's, does the
>>users history from all sessions go into the same file?  This
>>could be a real problem if I do a !r hoping to envoke rpm but
>>someone else using the same login just did an rm -rf *

from the bash(1) man page
" On startup, the history is initialized from the file named
  by  the  variable HISTFILE (default ~/.bash_history).  The
  file named by the value of HISTFILE is truncated, if  nec-
  essary, to contain no more than the number of lines speci-
  fied by the value of HISTFILESIZE.   When  an  interactive
  shell  exits, the last $HISTSIZE lines are copied from the
  history list to $HISTFILE.  If the histappend shell option
  is  enabled  (see  the  description  of  shopt under SHELL
  BUILTIN COMMANDS below), the lines  are  appended  to  the
  history  file,  otherwise the history file is overwritten.
  If  HISTFILE  is  unset,  or  if  the  history   file   is
  unwritable,  the  history  is not saved.  After saving the
  history, the history file is truncated to contain no  more
  than  HISTFILESIZE  lines.  If HISTFILESIZE is not set, no
  truncation is performed."




>yes and no on the history file...  yes it using the same history file, but 
>it is written to after log out, so if you log in on one tty, that history 
>is read from the file and held and modified in memory (I believe, it might 
>be a tmp file).  The second tty you connect with will ready the same file 
>and have the same history as the first, until a command is run.  if one 
>logs out, their updated history is written back to the history file, but I 
>am not sure if it uses the history it has in memory, or if it just adds on 
>to the end...  haven't looked... now I need to go look that up, or it will 
>bother me for days.  I'll get back to you, unless someone else knows already.
>
>
>>George
>>_______________________________________________
>>http://www.ntlug.org/mailman/listinfo/discuss
>
>--
>MadHat at unspecific.com
>
>"Focus on the packet.  It's better that way."
>                                              -tb
>
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss

--
MadHat at unspecific.com

"Focus on the packet.  It's better that way."
                                              -tb




More information about the Discuss mailing list