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

Re: bash: common history across multiple sessios ???

Also sprach Michael Naumann (Wed 05 Mar 02003 at 12:07:33AM +0100):
> On Tuesday 04 March 2003 21:41, Michael D. Schleif wrote:
> > This has been bugging me for several years, and today -- hopefully --
> > some kind soul is going to enlighten me ;>
> >
> > Several years ago, running ksh on several AIX and Solaris servers, and
> > many, many simultaneous xterm's open on many boxen, commandline history
> > was _common_ across all of my sessions on a given box.
> >
> > In other words, when I typed a long command string into one terminal,
> > later switched to another terminal session on same box, then I could
> > recall that particular command from history and edit/use it as I will.
> >
> > On bash setups, I am never clear which of many sessions gets the last
> > word writing to ~/.bash_history ?!?!  When I start another terminal
> > session, I never know what will and will not be in ~/.bash_history!
> >
> > Is there a way to coerce bash to behave as my old ksh?
> >
> > What do you think?
> Use 'history -a' in the shell with your long command and
> 'history -n' in the new shell.
> The first command writes (appends) the changes to you history-file,
> the latter reads these changes in.
> Also, I have
> trap 'history -a' EXIT
> in my .profile.

As Vineet points out, shopt appears to handle your latter suggestion.

Regarding the former, I am speaking of the general sense, in which I
frequently change terminal sessions, and I know that I typed out some
complex string in last couple of days, but I'm really not interested in
foraging all open sessions to find that one (1) exquisite instance ;>

This, imho, is a productivity issue, and I have never understood why
bash did not follow this ksh behaviour ;<

By-the-by, where does a bash session keep track of command history while
that session is open?

How does it know whether to use ~/.bash_history or this elusive memory

How would I go about requesting this enhancement?

Best Regards,

mds resource
Dare to fix things before they break . . .
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .

Attachment: pgpVebtmh80J3.pgp
Description: PGP signature

Reply to: