[prev in list] [next in list] [prev in thread] [next in thread]
List: bash-bug
Subject: Re: colored bash prompts seem to confuse readline
From: Chet Ramey <chet.ramey () case ! edu>
Date: 2010-02-09 19:27:34
Message-ID: 100209192734.AA97306.SM () caleb ! INS ! CWRU ! Edu
[Download RAW message or body]
> Well ok its not just a plain colored prompt, what I would like to use is
> this:
>
> txtred='\e[0;31m' # Red
> bldgrn='\e[1;32m' # Green
> txtrst='\e[0m' # Text Reset
> PROMPT_COMMAND=' \
> if [ $? -eq 0 ]; then \
> PROMPT_PREFIX="$txtred"; \
> else \
> PROMPT_PREFIX="$bldgrn$? "; \
> fi '
>
> PS1='$(echo -ne "$PROMPT_PREFIX")'"\$\[$txtrst\] "
All non-printing character sequences must be enclosed in \[...\].
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic