screen-users
[Top][All Lists]
Advanced

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

Re: workaround to not overwrite .bash_history


From: Software Groups
Subject: Re: workaround to not overwrite .bash_history
Date: Mon, 10 Jul 2006 18:15:41 -0400

Hi all,

I use BASH shell for my work. I have following setting to store BASH
history to file; this works Solaris 10 with bash 3.0. But with Fedora
Linux 5 with bash 3.1 its not working

I type command on one screen window (window number 1).  Then I can
switch to another screen windows (window number 2). Using up arrow key
I can get the same command.

Solairs it appends commands immediately (using tail I am watching the
file). Linux it's not appending to history file.

Any Idea why it's not working on Linux?

BASH_VERSINFO=([0]="3" [1]="1" [2]="7" [3]="1" [4]="release"
[5]="i386-redhat-linux-gnu")
BASH_VERSION='3.1.7(1)-release'
HISTFILE=/root/.bash_history
HISTFILESIZE=5000
HISTIGNORE='&:ls:ls *:clear:[bf]g:exit:du|who'
HISTSIZE=5000
HISTTIMEFORMAT='%D - %H:%M:%S '
PROMPT_COMMAND='shrhist; echo -ne "\033k`uname -n`\033\134" '

   shrhist ()
{
   history -a $HISTFILE;
   history -n $HISTFILE
}


Thanks



On 6/14/06, cga2000 <address@hidden> wrote:
On Tue, Jun 13, 2006 at 06:52:57PM EDT, Aaron Griffin wrote:
> You might be able to get by with something like:
>
> export PROMPT_COMMAND="history -a $HISTFILE"
>
this appends the current session's history list to the history file.
Since the OP wants to share the history across sessions I assume this
includes sessions that are already running?

In that case he would also need to do a "history -n".

I don't know if the PROMPT_COMMAND supports more than one command - and
it's a bit late to test. :-)

But he could probably define a bash function something like:

shrhist ()
{
       history -a $HISTFILE
       history -n $HISTFILE
}

.. thus keeping his history lists & history file in sync' ..?

Thanks,

cga
>
> _______________________________________________
> screen-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/screen-users


_______________________________________________
screen-users mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/screen-users



--
Software Groups (SFG)
http://www.sfgroups.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]