Stephen Gran on 13 Sep 2007 13:00:23 -0000


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

Re: [PLUG] Bash History question


On Thu, Sep 13, 2007 at 08:00:07AM -0400, Mag Gam said:
> Hello:
> 
> Just started to use Linux exclusively, and I have a question pertaining Bash
> History. I know the history is logged in .bash_history or ($HISTFILE var).
> My question is, when I fork a new shell ie.
> $ echo $$
> 2232
> $ bash
> $ echo $$
> 4434
> 
> Where is the history kept for bash.4434? and what happens to the history of
> bash.2232? How does this work, very confusing to me....

It's volatile, and generally written on logout:

test@qemu:~$ cat .bash_history
test@qemu:~$ bash
test@qemu:~$ ls
stuff     other_stuff
test@qemu:~$ echo yes
yes
test@qemu:~$ exit
test@qemu:~$ cat .bash_history
ls
echo yes
test@qemu:~$ 

on logout from the topmost shell, .bash_history will contain 
ls
echo yes
cat .bash_history
bash
cat .bash_history

Hope that helps,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | BOFH excuse #46:  waste water tank      |
|  steve@lobefin.net             | overflowed onto computer                |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug