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

Re: Colors



On Thu, Aug 06, 1998 at 09:13:52PM +0200, Remco van de Meent wrote:
> On Thu, 6 Aug 1998, Marcus Brinkmann wrote:
> 
>  :   set_prompt ()
>  :   {
>  :     local SAVE_CRS=`tput sc 2> /dev/null`
>  :     local RESET_CRS=`tput rc 2> /dev/null`
>  :     local CLOCKPOS=`tput cup 0 90 2> /dev/null`
>  :     local FOREG=`tput setf 6 2> /dev/null` 
>  :     local ALT_FOREG=`tput setf 3 2> /dev/null`
>  :     local BACKG=`tput setb 0 2> /dev/null`
>  :     local NORMAL=`tput sgr0 2> /dev/null`
>  :     local BOLD=`tput bold 2> /dev/null`
>  : 
>  :     PS1="\[${NORMAL}${SAVE_CRS}${CLOCKPOS}${FOREG}${BACKG}${BOLD} \@ ${RESET_CRS}${BOLD}${ALT_FOREG}\]\u\[${NORMAL}\]@\h:\w\$ "
>  :   }
>  :   set_prompt
> 
> Doesn't this execute those tput's everytime a new prompt has to be generated
> (i.e. after every command) ?

No. set_prompt is executed once (in my startup file), and the local
variables store the escape sequences only while setup_prompt is running.

The `...` will execute tput and store the ouput in the local variables. Then
this output is used to put together the prompt. The prompt does contain the
real escape sequences and is itself not portable to other terminals.

Thank you,
Marcus

-- 
"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: