Not signed in (Sign In)

LiveSearch

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthoredisp
    • CommentTimeDec 18th 2007
     
    Hi all,

    Because I'm using multiple xterms running bash I would like to share the command history between all bashes instantly.
    Meaning that if I enter a command in xterm-1 and change to xterm-2 afterwards I would like to see the same command in the history of that bash. I know that each bash procces maintains it's own history list synchronising it to history file only at session end and invocation of a new session but not at run time.
    I also know that I could force each bash updateing and rereading the history file by calling history -a; history -n every time but this is cumbersome an unpractical.
    How can I achieve that?
    • CommentAuthormarius
    • CommentTimeDec 18th 2007
     
    edisp: Here are some hints that might help you with your problem:

    1. You need to have histappend set in your bash environment to ensure that the histories from the different terms will not overwrite themselves. In case you don't have this set already you can put it somewhere in your bashrc:
    shopt -s histappend
    2. To my knowledge there is no parameter in bash to achieve what you are looking for (that sounds very reasonable btw, and should be like that by default imo). So you can try a trick in order to not have to type history -a; history -n all the time manually. You can try to put this in your PROMPT_COMMAND and append it to your existing one, like:
    PROMPT_COMMAND=’history -a; history -n’
    Let me know if this worked for you.

    Regards,
    - Marius -
    • CommentAuthoredisp
    • CommentTimeDec 18th 2007
     
    Marius,

    Thanks a lot. Setting of
    shopt -s histappend
    PROMPT_COMMAND=’history -a; history -n’
    solved my problem.

    Regards

    Edmund
    • CommentAuthorguest
    • CommentTimeJan 25th 2008
     
    guest:

    I used,
    shopt -s histappend
    PROMPT_COMMAND=’history -a; history -n’

    But when i looked in to history it has shown me something like,'

    myserver:~ # cat /root/.bash_history
    4304 ? Ss 0:00 /sbin/portmap

    Why?
    • CommentAuthormarius
    • CommentTimeJan 25th 2008
     
    guest: no idea (maybe you pasted it on another term screen by mistake?). besides that line, everything else is ok?

    - Marius -
    • CommentAuthorguest
    • CommentTimeJan 25th 2008
     
    guest:

    No, i am sure the history is shown like that.
    Can u plz clarify this?
    • CommentAuthorguest
    • CommentTimeJan 25th 2008
     
    guest:

    And one more question,

    the history would not be stored any more?
    • CommentAuthormarius
    • CommentTimeJan 25th 2008
     
    guest: sorry I have no idea. Without seeing this I can't help you on this issue as it never happened to me, and I have on idea why it would happen. Maybe someone else might help you if they have seen the same problem in the past.
    • CommentAuthorguest
    • CommentTimeJan 25th 2008 edited
     
    guest:

    Windhan(windhans at yahoo.com): Okay,Thanks Marius...
    • CommentAuthorguest
    • CommentTimeJan 25th 2008 edited
     
    guest:

    If some one else could tell me the reason for that ,
    Please send me mail to Windhan(windhans at yahoo.com)


    Thanks in Advance
    -Windhan
Add your comments

    Username Password
  • Format comments as