[solved] bash history disappears frequently

I have got a very annoying problem: My bash history "resets" from time to time for no perceivable reason. I hate to lose anything less than the last, say, 500 commands and yet the ******** thing sometimes get an amnesia attack.
Any ideas what might cause this?
Last edited by macaco (2015-05-06 15:35:25)

https://bbs.archlinux.org/viewtopic.php?id=150992
If that doesn't help, post your .bashrc and other shell profile configuration files.

Similar Messages

  • Safari history disappeared before my eyes

    I was viewing my history (first time since upgrading to Yosemite) and whilst doing so, and without touching anything, my history disappeared except for 2 sites for yesterday (I had viewed dozens yesterday and was in the middle of looking for one of them).  Everything else vanished.  Since then all my history for yesterday has disappeared too, so I only have history for today.  I can't find a reason for this in my settings - I have my history set up to delete after a year and I definitely didn't click to delete history.

    I just upgraded my MacBook Pro to Yosemite tonight. When I checked Safari Preferences, the previously-set History retention that had been two weeks had reverted to one day. I did not see that any other prefs had changed but that one was definitely different.
    So I suspect it is an upgrade issue within Safari.

  • 10.6 bash history-search-backwards

    This is a repost from http://discussions.apple.com/message.jspa?messageID=10954384
    10.6 broke my terminal history search
    In 10.4 I added
    bind '"M-[A": history-search-backward'
    bind '"M-[B": history-search-forward'
    to my .bash_profile allowing me to use the up/down arrows to search through the history in terminal, but as of 10.6 this no longer works.
    I would like the up and down arrows to perform a search of the history for the string I have typed in the terminal. That is if I had issued the following sequence of commands in the terminal,
    $cd ~/
    $nano .bash_profile
    $vi .bash_profile
    so now these commands are sequentially listed in my bash history. Now if I press the up arrow, the first command to come up will be the last one that I entered, that is, $vi .bash_profile. Now if I had instead pressed up three times, the command, $cd ~/ would come up. Now what I want bash to do, and had working in OS X 10.4, is if I type a string into the terminal (and DO NOT press ENTER) such as, $cd , then I press up, bash will search through the terminal history for the instances of the command cd that I have previously entered. This is the same behavior as the MATLAB command prompt.
    I know this is possible because it used to work. I would like to have this behavior again because it is very useful. I do know that I can use crl-R to search the history, but this is kind of a pain to use and it doesn't work very well.
    I added the above code to ~/.inputrc and now if I type the letter 'b' in terminal I get the output
    {quote}
    "": history-search-forward
    {quote}
    It only does this for the the letter 'b'. I have tried all the other keys and there is no weird output. What is up with bash?
    GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
    Also see threads:
    http://forums.macosxhints.com/showthread.php?p=569961#post569961 Mac OS X Hints 10.6 bash history-search-backwards
    http://www.macosxhints.com/article.php?story=20031026174236860 Mac OS X Hints 10.3: Assign arrow keys to history search in bash

    I have the following in my .bashrc file:
    # Setup Command line editing using vi mode (default is Emacs).
    # Map Ctrl-P and Up-arrow as command recall (previous),
    # with Ctrl-N and Down-arrow as next (foreword) command.
    # Viewing key binding:
    # bind -p | more # key bindings
    # bind -s | more # macros (like below)
    # bind -m vi-command -p | more # key bindings
    # bind -m vi-command -s | more # macros (like below)
    shopt -s -o vi # set vi command line editing.
    bind '"C-p": "ekA"' # Ctrl-P: when in insert mode
    bind -m vi-command '"C-p": "kA"' # Ctrl-P: when in insert mode
    bind '"C-n": "ejA"' # Ctrl-N: when in command mode
    bind -m vi-command '"C-n": "jA"' # Ctrl-N: when in command mode
    # I have had problems with a Linux version of Bash 2.05.8(1) that did not
    # like it when I remapped the up and down arrow keys, so if I find myself
    # with that version of bash, I do not try to remap them.
    # "cat -v" can be very useful for determing what the escape sequence being
    # issued by an keypad or function key. Keep in minde that the keypad has
    # multiple modes the terminal emulator can be placed in, which alters the
    # escape sequence, hence the multiple sets of mapping for up and down arrow
    # in both vi-insert and vi-command mode.
    if [[ "$BASH_VERSION" != 2.05.8(1) || $OSTYPE = darwin ]]; then #{
    bind '"M-OA": "ekA"' # Up-arrow: when in insert mode
    bind -m vi-command '"M-OA": "kA"' # Up-arrow: when in insert mode
    bind '"M-OB": "ejA"' # Down-arrow: when in command mode
    bind -m vi-command '"M-OB": "jA"' # Down-arrow: when in command mode
    bind '"M-[A": "ekA"' # Up-arrow: when in insert mode
    bind -m vi-command '"M-[A": "kA"' # Up-arrow: when in insert mode
    bind '"M-[B": "ejA"' # Down-arrow: when in command mode
    bind -m vi-command '"M-[B": "jA"' # Down-arrow: when in command mode
    fi #}
    The above does work for me on ALL my platforms (Mac OS X, Tiger, Leopard, Snow Leopard), Linux, Solaris, AIX, and Windows-Cygwin.
    I use vi command line editing, so if you prefer the emacs command line editing, then the above will not work for you, in some cases I map the up/down arrows and Control-P/Control-N to vi commands.

  • HT1430 hey, I just reset my Apple ID and suddenly much of my Iphone text history disappeared.  and I can send texts, but not receive any.  what do I do?  is this related to AppleID, or is the text issue from something else?  thx!

    hey, I just reset my Apple ID and suddenly much of my Iphone text history disappeared.  and I can send texts, but not receive any.  what do I do?  is this related to AppleID, or is the text issue from something else?  thx!

    Hi blyther,
    Thanks for using Apple Support Communities.  If you're unable to receive texts, see this article for troubleshooting steps:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Cheers,
    - Ari

  • Bash history

    my bash cmdhist, invoked by the <prior> key only remembers one command. I emptied ~/.bash_history and it remembers the first command entered in the new ~/.bash_history but not the rest.
    shopt
    autocd off
    cdable_vars off
    cdspell off
    checkhash off
    checkjobs off
    checkwinsize off
    cmdhist on
    compat31 off
    compat32 off
    compat40 off
    compat41 off
    dirspell off
    dotglob off
    execfail off
    expand_aliases on
    extdebug off
    extglob off
    extquote on
    failglob off
    force_fignore on
    globstar off
    gnu_errfmt off
    histappend off
    histreedit off
    histverify off
    hostcomplete on
    huponexit off
    interactive_comments on
    lastpipe off
    lithist off
    login_shell off
    mailwarn off
    no_empty_cmd_completion off
    nocaseglob off
    nocasematch off
    nullglob off
    progcomp on
    promptvars on
    restricted_shell off
    shift_verbose off
    sourcepath on
    xpg_echo off

    Aha!  <Prior> is the <PageUp> key!  <Prior> is working on the OP's keyboard exactly the way it does on mine – it takes me to the beginning of the history file, the first command.  To access the last command in the history, use the <Up> (arrow).  More presses of the <Up> key take you further into bash history.
    Somewhat off topic, but not too far off:
    Actually, I would use '!!' to repeat the very last command and '!-2' for the command before that, and so on.  When I do not want the command to execute, I'll use this format: '!-5:p'.  That will print the fifth command back in history but won't execute it.
    You can use a pipe and grep the history command output when searching through it:
    history | grep wget
    When I find the command's event designator, I'll use it, '!507'.
    I add comments on the command line when I know I'll want a complex or a long command again soon:
    $ mupdf -r 96 ~/shared/books/poetry/pdf/leaves_of_grass.pdf 102 & # Add 26 to page no.
    That lets me search more quickly using 'Ctrl-R' and then '#' (or '##', or '###'...).
    Last edited by thisoldman (2011-12-11 23:29:44)

  • [solved]zsh history completion not matching after first word?

    Hi!
    I just switched to zsh some days ago and I can't get the history search completion working like it's used to work with bash (history-search-backward /  history-search-forward)
    I installed grml-zsh-config, tried to rewrite most of my .bashrc to work with zsh... read a lot of man pages and changed some settings (and broke some random things... and un-broke most of them again)...
    Now when I enter p.e.:
    $ sudo tes
    ...and press the up/down arrows, it keeps the "sudo" but not the "tes" - it goes trough all commands that I called with sudo. Seems to behave the same way for other commands - keeps the first word, ignores everything else I typed.
    No idea what this is called, what it's good for or how to change it.
    Where do I look for this?
    Last edited by whoops (2012-12-01 19:09:52)

    ^ I've not used that, so I can't say whether or not my solution is better or worse. However, I suggest using "up-line-or-beginning-search"/"down-line-or-beginning-search", as described in zshall:
    up-line-or-beginning-search, down-line-or-beginning-search
    These widgets are similar to the builtin functions up-line-or-search and
    down-line-or-search: if in a multiline buffer they move up or down within the buf‐
    fer, otherwise they search for a history line matching the start of the current
    line. In this case, however, they search for a line which matches the current line
    up to the current cursor position, in the manner of history-beginning-search-back‐
    ward and -forward, rather than the first word on the line.
    From my .zshrc:
    autoload up-line-or-beginning-search
    autoload down-line-or-beginning-search
    zle -N up-line-or-beginning-search
    zle -N down-line-or-beginning-search
    bindkey "\e[A" up-line-or-beginning-search
    bindkey "\e[B" down-line-or-beginning-search

  • Save Bash History Merged?

    I'd REALLY like to save BASH history from multiple windows and sessions.
    How would I access the various histories of multiple windows and save them before exiting automatically?
    Is there a "trap" command or something that I could script to execute upon exiting the session?  Perhaps to
    merge these into a single HISTFILE?
    ALSO - is there a way to dynamically update the window title header?  Such as copying the current prompt into the title
    and to give details on the job, the remote machine being accessed, etc.?

    I assumed that the OP knew that his problem (passwords) were in root's history.
    Unless you have a habit of running sudo with -H or if you have root logins enabled, root shares your settings (since sudo without -H keeps the original user's HOME) and runs .bashrc from the original user's HOME, saves history in there etc.
    Quick test with:
    host user $ sudo bash
    Password:
    host user # echo hello_world
    hello_world
    host user # exit
    host user $ grep hello_world .bash_history
    echo hello_world
    host user $

  • [SOLVED] bash: $'\302\240grep': command not found [frequent CLI error]

    For the past several days I've been getting the following error frequently on the command line:
    bash: $'\302\240grep': command not found
    I think I'm only getting this error in response to commands that are piped to grep, such as the following:
    $ ps -ef | grep xyz
    or
    $ locate | grep abc
    However, I don't think I've gotten the error if I type the same commands as above, but without the space between '|' and 'grep'.  And, although the error is frequent, it doesn't happen every time; it is seemingly random.
    Anybody else experiencing this?  Any idea what might be causing it? 
    I'm using rxvt-unicode as my terminal.
    Jay
    Last edited by jt512 (2011-04-06 04:38:56)

    anonymous_user wrote:Post your ~/.bashrc
    # Check for an interactive session
    [ -z "$PS1" ] && return
    function timer () {
    at -f /home/jay/.timercmd now + $1 min
    function cpufs () {
    sudo cpufreq-set -c 0 $1 $2
    sudo cpufreq-set -c 1 $1 $2
    alias ls='ls --color'
    alias kc='~/scripts/kc.py'
    alias diff='colordiff'
    alias s2ram='sudo s2ram -f'
    alias grep='grep --color=always'
    alias Terminal='Terminal -T Terminal'
    alias emacsnw='emacs -nw -f menu-bar-mode'
    alias rm='rm -I'
    alias lpstd='lp -o "StpQuality=Standard"'
    alias paps='paps --paper letter --font="Courier 10"'
    alias mp='mplayer'
    alias mps='mplayer -softvol-max 600'
    alias mysql='$HOME/scripts/mysql'
    if [ $TERM = 'linux' -a $SHELL = '/bin/bash' ] ; then
    PS1='\033[?17;0;40c[\u@\h \W]\$ '
    else PS1='[ \[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;31m\]\W\[\e[m\] \[\e[m\]]\[\e[0;32m\] \$ \[\e[m\]'
    fi
    eval `dircolors -b`
    # Allow tab completion for sudo'ed commands
    complete -cf sudo
    export PATH=$PATH:~/.local/usr/bin
    export EDITOR="vim"
    export BROWSER='conkeror:uzbl-browser:firefox'
    export GREP_COLOR="1;33"
    export LESS_TERMCAP_mb=$'\E[01;31m'
    export LESS_TERMCAP_md=$'\E[01;31m'
    export LESS_TERMCAP_me=$'\E[0m'
    export LESS_TERMCAP_se=$'\E[0m'
    export LESS_TERMCAP_so=$'\E[01;44;33m'
    export LESS_TERMCAP_ue=$'\E[0m'
    export LESS_TERMCAP_us=$'\E[01;32m'
    export SWEAVE_STYLEPATH_DEFAULT="TRUE"

  • [SOLVED] Bash changes consolle's colors by itself

    Hi archers,
    I've wrote a little script which ask for the result of a given random moltiplication because I was exercising with $RANDOM and something strange's happend.
    No matter where I am (Tty, Tmux, Urxvt, Xterm...) Bash changes consolle's colors by itself if I do ^c to stop the script, instead of write a reply.
    i.e.'s:
    correct behaviour
    $ 8 * 9 = ?
    $ 72
    $ ls
    file in red file in yellow file in grey...
    Wrong behaviour
    $ 8 *9 = ?
    $ ^c
    $ ls
    file in blue file in green file in white...
    What the heck?
    Bash version is 4.2.39(2)-release.
    The script is the following:
    while :
    do
    min="3"
    max="7"
    fat1="$(($RANDOM%$max+$min))"
    fat2="$(($RANDOM%$max+$min))"
    prod="$(($fat1*$fat2))"
    echo "$fat1 * $fat2 = ?"
    read res
    while [ "$res" != "$prod" ]
    do
    echo "$prod"
    echo "Insert the correct result."
    tavPit
    done
    return 0
    done
    Everything is up to date.
    .bashrc
    [[ $- != *i* ]] && return
    complete -cf sudo
    [ -f /etc/bash_completion ] && ! shopt -oq posix && . /etc/bash_completion
    [ -f ~/.bash/include ] && . ~/.bash/include
    [ -e "$HOME"/.dircolors ] && eval $(dircolors -b "$HOME"/.dircolors)
    include
    #!/bin/bash
    [ -f ~/.bash/alias ] && . ~/.bash/alias
    [ -f ~/.bash/color ] && . ~/.bash/color
    [ -f ~/.bash/export ] && . ~/.bash/export
    [ -f ~/.bash/shopt ] && . ~/.bash/shopt
    [ -f ~/.bash/stty ] && . ~/.bash/stty
    [ -f ~/.bash/set ] && . ~/.bash/set
    color
    nc="\e[0m"
    nbk="\e[0;30m"
    nre="\e[0;31m"
    ngr="\e[0;32m"
    nye="\e[0;33m"
    nbl="\e[0;34m"
    nma="\e[0;35m"
    ncy="\e[0;36m"
    nwh="\e[0;37m"
    bbk="\e[1;30m"
    bre="\e[1;31m"
    bgr="\e[1;32m"
    bye="\e[1;33m"
    bbl="\e[1;34m"
    bma="\e[1;35m"
    bcy="\e[1;36m"
    bwh="\e[1;37m"
    end="\[\e[m\]"
    man() {
    env \
    LESS_TERMCAP_mb=$(printf "\e[0;32m") \
    LESS_TERMCAP_md=$(printf "\e[0;32m") \
    LESS_TERMCAP_me=$(printf "\e[0m") \
    LESS_TERMCAP_se=$(printf "\e[0m") \
    LESS_TERMCAP_so=$(printf "\e[1;31m") \
    LESS_TERMCAP_ue=$(printf "\e[0m") \
    LESS_TERMCAP_us=$(printf "\e[1;33m") \
    man "${@}"
    if [ "$TERM" = "linux" ]; then
    echo -en "\e]P0000000" # Black.
    echo -en "\e]P9ff0000" # Red.
    echo -en "\e]PA00ff00" # Green.
    echo -en "\e]PBffff00" # Yellow.
    echo -en "\e]PC2b4f98" # Blue.
    echo -en "\e]PDff00ff" # Magenta.
    echo -en "\e]PE00ffff" # Cyan.
    echo -en "\e]PFffffff" # White.
    clear
    fi
    .dircolors
    TERM linux
    TERM linux+utf8
    TERM rxvt-unicode
    TERM rxvt-unicode-256color
    TERM screen
    TERM screen-256color
    TERM xterm
    TERM putty
    EIGHTBIT 1
    NORMAL 01;30
    FILE 01;30
    DIR 31
    LINK 36
    FIFO 03;33
    SOCK 03;33
    DOOR 32
    BLK 32
    CHR 32
    ORPHAN 05;33
    EXEC 33
    .tar 31
    .tgz 31
    .arj 31
    .taz 31
    .lzh 31
    .zip 31
    .7z 31
    .z 31
    .Z 31
    .gz 31
    .bz2 31
    .deb 31
    .rpm 31
    .jar 31
    .rar 31
    .xz 31
    .jpg 35
    .jpeg 35
    .gif 35
    .bmp 35
    .pbm 35
    .pgm 35
    .ppm 35
    .tga 35
    .xbm 35
    .xpm 35
    .tif 35
    .tiff 35
    .png 35
    .fli 35
    .gl 35
    .dl 35
    .xcf 35
    .xwd 35
    .pdf 35
    .ogg 34
    .mp3 34
    .wav 34
    .mov 34
    .mpg 34
    .mpeg 34
    .asf 34
    .avi 34
    .mkv 34
    .wmv 34
    .ogm 34
    .C 37
    .H 37
    .c 37
    .h 37
    .cxx 37
    .hxx 37
    .cpp 37
    .hpp 37
    .py 37
    .sh 37
    .vim 37
    .o 37
    .so 37
    .a 37
    .ko 37
    .rc 36
    *rc 36
    Thanks a lot.
    Last edited by rix (2012-11-26 15:38:28)

    Bandit Bowman wrote:My colours are unaffected after running the function. [...]
    Here colors change when I send SIGINT to a running instance of my script; as said before.
    Bandit Bowman wrote:[...] What does $LS_COLORS look like before and after? [...]
    When everything is working right:
    $ echo $LS_COLORS
    $ no=01;30:fi=01;30:di=31:ln=36:pi=03;33:so=03;33:do=32:bd=32:cd=32:or=05;33:ex=33:
    *.tar=31:*.tgz=31:*.arj=31:*.taz=31:*.lzh=31:*.zip=31:*.7z=31:*.z=31:*.Z=31:*.gz=31:
    *.bz2=31:*.deb=31:*.rpm=31:*.jar=31:*.rar=31:*.xz=31:*.jpg=35:*.jpeg=35:*.gif=35:
    *.bmp=35:*.pbm=35:*.pgm=35:*.ppm=35:*.tga=35:*.xbm=35:*.xpm=35:*.tif=35:*.tiff=35:
    *.png=35:*.fli=35:*.gl=35:*.dl=35:*.xcf=35:*.xwd=35:*.pdf=35:*.ogg=34:*.mp3=34:
    *.wav=34:*.mov=34:*.mpg=34:*.mpeg=34:*.asf=34:*.avi=34:*.mkv=34:*.wmv=34:*.ogm=34:
    *.C=37:*.H=37:*.c=37:*.h=37:*.cxx=37:*.hxx=37:*.cpp=37:*.hpp=37:*.py=37:*.sh=37:
    *.vim=37:*.o=37:*.so=37:*.a=37:*.ko=37:*.rc=36:*rc=36:
    When texts change color (the strange behaviour):
    $ echo $LS_COLORS
    $
    Bandit Bowman wrote:[...] Is this the whole script or just a snippet [...]
    Whole.
    Bandit Bowman wrote:[...] because I don't see anything that should modify it. [...]
    That's why I'm asking.
    Bandit Bowman wrote:[...] here's a slightly more straightforward version [...]
    Thanks, I've learnt something.
    Bandit Bowman wrote:[...] although it won't help with the colours.
    Thanks for the reply anyway.
    Bandit Bowman wrote:[...] English: [...]
    Also, many thanks again.
    Edit: solved. "$LS_COLORS" must be set if you want colors.
    Last edited by rix (2012-11-26 15:38:06)

  • [SOLVED] bash: sleep not a builtin?

    hello,
    i have a few scripts running in endless loops, using the sleep command.
    this causes constant i/o - not much, but nevertheless.
    i went to investigate this further and found that on (archlinux') bash, sleep is not a builtin by default, nor can it be enabled with the "enable" command.
    this seems less than optimal to me.
    i can't find any packages that would remedy that, either.
    how can i solve this?
    thoughts, most preferable first:
    1) there is some other bash-builtin i've missed, or some workaround that has the same effect.
    2) copy the sleep command to /dev/shm/bin and add that to my path. feels hackish, but why not?
    3) recompile bash (i read the debian version has sleep as a builtin)?
    4) change to another (preferably bash-compatible) shell?
    cheers,
    o.
    Last edited by ondoho (2014-01-06 21:29:31)

    dzen for system resource monitoring was something I wanted to bring up, but I wasn't sure what purpose of your script, so I didn't bring it up.
    About two or three years ago, I switched to dzen from Conky for system resource monitoring. Like many people, suggestions, and examples on the Internet, I used Bash to write the script [1] to feed the data into dzen. It wasn't long before I realize the script had eaten up 100MB memory.
    It was the time I first noticed the issue with Bash scripting. Yes, there are times for cron and should be used with cron, but for this situation and type of case, you can't. I did try to isolate the problem by removing some monitoring components, but, IIRC, the memory was still being eaten.
    The 3,000 iterations in my previous might sound a lot at first glance, but the point isn't the iterations but how many invocations of external commands. And 3000 calls of external externally actually ain't a lot, even for one-off or once in long time scripts. That's where the problem is linked from what I see, although I still don't know what the actually cause is.
    After I failed to find the leak--or is there really one? I ported the Bash script to C [2]. It's much efficient.
    Note that for both code, they are updating as fast as 0.2 seconds depending on what system resources. I found 1 second is too long, especially when you are pressing volume up key, even it's roughly okay for system clock.
    I'd advise everyone to take a close look at "TIME+" in top/htop, you might find some programs that you don't expect to use that much time and some the other way around.
    By the way, when I said "little obsessive" about myself, I only meant PS1 in loadable C extension is obsessive--who even does like `enable -f vimps1 vimps1` for your PS1? But other parts don't count, because those are clearly wasting if the code is executed a lot and you don't deal with.
    [1]: https://github.com/livibetter/dotfiles/ … /status.sh
    [2]: https://github.com/livibetter/dotfiles/ … n/status.c

  • [solved] bash errors

    Howdy, first post here, installed arch last week after many years on debian based systems.
    I promise I have read the wiki on bash & have googled for hours & I cannot find what is generating these errors in the terminal every time a terminal is opened.
    bash: N: command not found
    bash: $!ba: command not found
    bash: s/n/: No such file or directory
    I can't recall at what point this error started to appear.  I have checked .bashrc, my bash aliases, I am stumped.
    My .bashrc :
    # ~/.bashrc
    # If not running interactively, don't do anything
    [[ $- != *i* ]] && return
    alias ls='ls --color=auto'
    PS1='[\u@\h \W]\$ '
    export LANG=en_GB.utf8
    export LC_MESSAGES="C"
    export LC_ALL=en_GB.utf8
    export EDITOR=nano
    source /usr/share/doc/pkgfile/command-not-found.bash
    # Alias definitions.
    # You may want to put all your additions into a separate file like
    # ~/.bash_aliases, instead of adding them here directly.
    # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    if [ -f ~/.bash_aliases ]; then
        . ~/.bash_aliases
    fi
    Last edited by cl00t (2013-07-25 18:33:50)

    Great :-)
    Next time when pasting configs, code or command output, please use [ code ] tags https://bbs.archlinux.org/help.php#bbcode
    like this
    It makes the code more readable and - in case of longer listings - more convenient to scroll through.
    Please remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309

  • [SOLVED] Bash coloured prompt issues

    Hi, I'm having trouble with my bash prompt and after going through a sea of posts on prompts I can't seem to figure out why mine isn't giving the desired behaviour.
    YELLOW='\[\e[0;33m'
    WHITEBOLD='\[\e[1;37m'
    WHITE='\[\e[0;37m'
    ORANGE='\[\e[1;31m'
    PS1="${WHITE}[${ORANGE}\u\] ${YELLOW}\@\] ${WHITEBOLD}\$(parse_git_branch)\] ${ORANGE}>\] ${YELLOW}\w\]${WHITE}]\] \$"
    The desired output:
    [will 06:48 PM (master) > ~/.vim] $
    When I scroll through the history the prompt messes up and starts looking like this:
    [will vim ~/.bashrc
    Last edited by will.price94 (2012-02-27 21:02:26)

    The prompt counts your color sequences as characters which messes up the cursor position. Escape the ${WHITE} and ${YELLOW} etc. by putting them between \[  \] like this: \[${WHITE}\] . In your case, include the closing \] when you define the color variables, so
    YELLOW='\[\e[0;33m\]' so you don't have to worry about them in the PS1= sequence.
    Edit: try like this (maybe remove some spaces, haven't tried the prompt myself)
    YELLOW='\[\e[0;33m\]'
    WHITEBOLD='\[\e[1;37m\]'
    WHITE='\[\e[0;37m\]'
    ORANGE='\[\e[1;31m\]'
    PS1="${WHITE}[${ORANGE}\u ${YELLOW}\@ ${WHITEBOLD}\$(parse_git_branch) ${ORANGE}> ${YELLOW}\w${WHITE}] \$"
    Last edited by VCoolio (2012-02-27 20:26:34)

  • Bookmarks &history disappeared - cannot import/restore,new bookmarks not saved

    My bookmarks & history have completely disappeared. Organiser completely empty. When I try 'Import:restore' and choose a date, message tells me cannot process file! When I try to bookmark an open page, it doesn't get added to bookmarks list. I am running Firefox 3.6.3 on XP. Please reply in words of one syllable as I'm not an expert on inner workings of Firefox.

    See http://kb.mozillazine.org/Unable_to_process_the_backup_file_-_Firefox

  • SOLVED: bash upgrade, prompt issues

    Just did a pacman -Syu and it fetched bash-4.0.033-1. However now whenever a open a bash shell as a user (not root), my prompt has this at the start:
    0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} (~)
    ... followed by the usual [user@host ~]$
    Now I assume this is caused by this line in profile.bash:
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
    export PROMPT_COMMAND
    Unfortunately there is no backup of said file, so I have no idea what this line used to look like. I'm going to hazard a guess that "\033]0;" should be a "[", and "\007" should be "]".
    Edit: Forgot to mention that I'm using rxvt-unicode for the terminal.
    Edit2: It seems the relevant file was /etc/bash.bashrc, and the solution was to simply remove rxvt-unicode from the if statement.
    Last edited by ptepid (2009-09-26 11:12:25)

    Okay, there's something else going on here. I just happened to be messing with ANSI escape codes for something else and the same issue arose.
    For instance
    [ptepid@securis ~]$ echo -e "Test1 \033[1;34m Test2 \033[0m"
    1;34m Test2 (~)Test1 Test2
    [ptepid@securis ~]$
    That echo statement should print "Test1 Test2" with test2 in blue (not shown here). It does that, but it's also spitting out the escape codes as garbage beforehand.
    Turns out only one user is affected. I'm trying to hunt down what is causing it, but I can't find any ENV variables that are different. It's only happening in X, but it's a problem with both rxvt and rxvt-unicode.
    SOLVED: Okay, now I feel pretty dumb. It was some bogus code in my .bashrc that was meant to update the titlebar of an xterm. That worked, but it also seems to mess with ANSI escape characters. This was the offending code:
    if [[ -n "$DISPLAY" ]]; then
    if [[ -n $MRXVT_TABTITLE ]]; then
    trap 'echo -ne "\e]61;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG
    else
    trap 'echo -ne "\e]0;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG
    fi
    fi
    A relic from when I'd used mrxvt.
    Last edited by ptepid (2009-09-26 11:11:55)

  • [SOLVED]Bash prompt colors different in console as opposed in terminal

    Hi
    EDIT: I have solved the problem by copying /etc/skel/.bash_profile to my home directory.
    Today i updated the system and the bash prompt is fine in my terminal (KDE Konsole or in Xterm) but not in consoles. For normal user (blue colors) i use this settings in the $HOME/.bashrc file:
    PS1='[\e[0;36m\u\e[0m@\e[0;36m\h\e[0m]─[\e[0;33m\w\e[0m]\n└─\$ '
    For root (red color) /root/.bashrc:
    PS1='[\e[1;31m\u\e[0m@\e[1;31m\h\e[0m]─[\e[0;33m\w\e[0m]\n└─\$ '
    Now, if i login in console as a normal user it doesn't display blue color but red as if i was root user. Like i said in xterm or KDE Konsole it looks just fine. The case is that consoles don't use my .bashrc file and use instead /etc/bash.bashrc file: Here is my /etc/bash.bashrc file:
    # /etc/bash.bashrc
    # If not running interactively, don't do anything
    [[ $- != *i* ]] && return
    #PS1='[\u@\h \W]\$ '
    PS1='[\e[1;31m\u\e[0m@\e[1;31m\h\e[0m]─[\e[0;33m\w\e[0m]\n└─\$ '
    PS2='> '
    PS3='> '
    PS4='+ '
    case ${TERM} in
    xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
    screen)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
    esac
    [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
    export EDITOR=/usr/bin/nano
    Here is my today's update:
    [2012-07-06 08:54] upgraded linux-api-headers (3.3.8-1 -> 3.4.4-1)
    [2012-07-06 08:54] warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
    [2012-07-06 08:54] Generating locales...
    [2012-07-06 08:54] en_GB.UTF-8... done
    [2012-07-06 08:54] en_GB.ISO-8859-1... done
    [2012-07-06 08:54] Generation complete.
    [2012-07-06 08:54] upgraded glibc (2.15-12 -> 2.16.0-1)
    [2012-07-06 08:54] upgraded binutils (2.22-7 -> 2.22-8)
    [2012-07-06 08:54] upgraded dbus-core (1.6.0-5 -> 1.6.2-2)
    [2012-07-06 08:54] upgraded dbus (1.6.0-1 -> 1.6.2-1)
    [2012-07-06 08:54] upgraded device-mapper (2.02.96-2 -> 2.02.96-3)
    [2012-07-06 08:54] upgraded gcc-libs (4.7.1-3 -> 4.7.1-4)
    [2012-07-06 08:54] upgraded gcc (4.7.1-3 -> 4.7.1-4)
    [2012-07-06 08:54] upgraded grep (2.12-1 -> 2.13-1)
    [2012-07-06 08:54] upgraded initscripts (2012.06.3-1 -> 2012.06.3-2)
    [2012-07-06 08:54] upgraded libpurple (2.10.4-2 -> 2.10.5-1)
    [2012-07-06 08:54] upgraded libusb-compat (0.1.4-1 -> 0.1.4-2)
    [2012-07-06 08:54] upgraded lvm2 (2.02.96-2 -> 2.02.96-3)
    [2012-07-06 08:54] upgraded mpfr (3.1.0.p10-1 -> 3.1.1-1)
    Is it a problem in yesterday's pam upgrade? Yesterday i have moved /etc/pam.d/login.pacnew to /etc/pam.d/login. I didn't backup the old file. My bad. Weird thing is also this that today my KDE session crashed (for the first time) when i have used dd to burn image on my USB.
    Last edited by Shark (2012-07-06 08:40:31)

    Procyon wrote:What you want is [ -n "$SSH_CONNECTION" ] (variable is set/nonzero length) or the opposite [ -z "$SSH_CONNECTION" ] (variable is not set/zero length)
    Thanks-- that got it.  I was missing the quotes, so it was expanding at the spaces rather than interpreting the entire thing as a string.

Maybe you are looking for

  • How to reset a 4s ?

    i used 4s , now using 5s , put the sim to new 5s, Now forgotten what was restriction code of 4s phone to reset and used with another sim.

  • Report Painter - adding columns with any texts.....

    Hello ! Whether probably in Report Painter to create additional columns (adhered to columns of data) and to write there manually demanded texts for lines ?

  • MIRO-Un planned cost

    Hi,   what is impact of following scenario. GR date and qty 20/05/2008 and material A:qty: 100 material B:qty: 100 MIRO: on 30/05/2008 qty: 100 during miro creation in that particular plant there was only 50 qty of material A ( rest of the stock is c

  • Docsis CMTS SNMP traps issue

    Hi all , If anyone can help me ( maybe with config issue )  When cable modem goes offline / online i get this messages  This is happening whit any type of modem . Does someone using traps on CMTS , any working config example ? Cable modem goes offlin

  • New features in EP7.0

    Hi All,            Can you please direct me to the link/document where in I can get new features that are released as part of EP7.0 and comparisons with EP6.0. Thanks Prathima