Re: Sharing bash history [was Re: Horrible X11 Problems on OS X (iBook)]
Re: Sharing bash history [was Re: Horrible X11 Problems on OS X (iBook)]
- Subject: Re: Sharing bash history [was Re: Horrible X11 Problems on OS X (iBook)]
- From: robert delius royar <email@hidden>
- Date: Wed, 22 Dec 2004 16:34:08 -0500 (EST)
- Organization: An Apple OS X end user
- Priority: NEW
Wed, 22 Dec 2004 (21:08 -0000 UTC) Viv Kendon wrote:
On Wed, 22 Dec 2004, Don MacQueen wrote:
At 3:41 PM +0000 12/22/04, Noah Slater wrote:
I was having loads of problems getting X11 to work as well. It all
came down to configuration and startup scripts.
If your xterm is using a default Bash shell and so is Terminal.app
they will of course share the same history as this information is
located in ~/.bash_history
Are you sure?? If you open two separate shells in Terminal.app, do they
share history?
Not exactly...when you start an interactive bash shell in xterm or Terminal
or whatever, it reads in the .bash_history file and continues to add to the
copy it keeps in memory. When the shell exits it writes the file back to
disk, overwriting whatever was there. So what you have in your history file
depends on which shell you last quit from...
As one who usually has at least half a dozen xterms around at any one time,
plus a couple of Terminal windows, I do
occasionally find this bizzare or annoying, but I can't think of a better way
to do it...
You should be able to add some tests to your startup and set your HISTFILE
value based on those values. In tcsh I set up two XTerms this way, one
plain, and one named Darwinports. The Darwinports version sets the path
differently from the plain one. It also saves its own history file and
directory stack. I could just use a number the increments up to ten I
suppose (.tcsh_historyXX for XX = 1 to 10). That would require some looking
at my environment, perhaps setting a variable to "1" if it does not exist or
a tmp file does not exist and incrementing it one if it does exist and is
less than 10 (or whatever). I suppose you could then place
export THISXTERM=0
/usr/X11R6/bin/xterm -title "XTerm $((THISXTERM+1))"
in your .xinitrc to "seed" the process, and add tests to .bashrc to handle
the increments (on the theory that .xinitrc gets called but once).
--
Dr. Robert Delius Royar Associate Professor of English
Morehead State University Morehead, Kentucky
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden