[Eug-lug] To Horst-Q/colours
Allen Brown
allen_brown at agilent.com
Wed Jan 12 15:39:37 PST 2005
Bob Miller wrote:
> Allen Brown wrote:
>
>
>>This is not working for me. All I get is a box where I try to
>>print the escape char, followed by the other chars.
>> ESC=$(echo -ne "\033")
>> echo -e "${ESC}31;1foo"
>>should print a red "foo". Instead I get
>> []31;1foo
>>where [] represents a single character.
>
>
> Uh, the sequence you need to output is
>
> escape left-bracket number semicolon one letter-m
>
> And to return to normal color, you need to output
>
> escal left-bracket letter-m
>
> Or, in bash syntax,
>
> echo "${ESC}[31;1mfoo${ESC}[m"
That's better. I now have
if [ "${COLORTERM-}" = "gnome-terminal" ]; then
PS1='\[\033[361m\]\h:\W\$\[\033[m\] '
else
PS1='\h:\W\$ '
fi
in /etc/bashrc.
> Did you catch the python script I sent out last week on this topic?
I remember something going by. But I couldn't find it today.
--
Allen
More information about the EUGLUG
mailing list