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

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



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.

HTH, Michael



Reply to: