Bug?: barevny bash prompt

Martin 'Goran' Moravec goran na ipp.cas.cz
Pátek Červen 30 10:46:11 CEST 2000


> Pri pouzivani barevneho promptu v bashi dochazi k chybam.
> Kdyz je prompt delsi nez jeden radek a prikaz taky, pri jeho
> editaci (prikazu) dochazi k spatnemu zobrazeni jak promptu tak prikazu.
> 
> Pokud je prompt kratsi nez jeden radek, k zadnym problemum (zatim)
> nedochazi (i kdyz je prikaz presahuje radek)
> 
> 
> mam v /etc/bashrc:
> PS1='[\[\033[0;36m\]\u\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\]> '
> 
ta chyba se da odstranit dalsim uzavorkovanim - bohuzal nevim kde, ale zda se mi
lepsi resit barvicky v shellu takto:


###---------->User<->Bash interface/Prompting/General<----------
_tty_nejm(){ _s_econd `who am i`; }
TTY_NAME=`_tty_nejm`
_BOLD=`tput bold`
_RESET=`tput sgr0`
_C2=`tput setf 2`
_C6=`tput setf 6`
_C4=`tput setf 4`
_NORM=`tput setf 7`$_RESET
###---------->User<->Bash interface/Prompting/Primary prompt<----------
### Primary prompt
([ -n "$TTY_NAME" ] || [ -z "$PS1" ]) && export PS1="\[$_C2\]\u\[$_C6\]@\[$_C4$_
BOLD\]\h\[$_RESET$_C6\]:\[$_C2$_BOLD\]$TTY_NAME\[$_C6\]\w\[$_C2\]\$\[$_NORM\]"
###---------->User<->Bash interface/Prompting/Secondary prompt<----------

export PS2="\[$_C4\]>\[$_NORM\]"

###---------->User<->Bash interface/Prompting/Prompt 3<----------
### Prompt 3

export PS3="\[$_C4\]#?\[$_NORM\] "

###---------->User<->Bash interface/Prompting/Prompt 4<----------
### Prompt 4

export PS4="\[$_C2\]+\[$_NORM\]"


tohle totiz nedela problemy v nekterych broken terminalech (alespon me)


-- 
--
    A novice was trying to fix a broken lisp machine by turning the
power off and on.  Knight, seeing what the student was doing spoke sternly,
"You cannot fix a machine by just power-cycling it with no understanding
of what is going wrong."  Knight turned the machine off and on.  The
machine worked.			
--					Just another from of life
						Goran


Další informace o konferenci Linux