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

Re: Bash Prompt and Color



On Thu, 2003-12-11 at 17:17, Mark wrote:
> Hello,
> I was recently playing around with my bash prompt and PS1 variable. I
> changed my ~/.bashrc to:
> 
> if [ "$TERM" = "linux" ]
> then
>   #we're on the system console or maybe telnetting in
>   export PS1="[\w]\n[\u@\H]\$ "
> else
>   #we're not on the console, assume an xterm
>   export PS1='\e[31:m[\w] \@\n\e[34:m[\u@\H]\$\e[0m '
> fi
> 
> 
> Does anyone know why, when I have an xterm, the cursor stays red?  The
> site that helped me customize it said that \e[0m would change it back
> (at least thats how I understood it when I read it).

Mark,

I use an alternate syntax for the ANSI sequences. Maybe something like
this will give you better results:

PS1="\n\\033[1;31m`cat /etc/redhat-release`\n\\033[1;34m\d  \\033[0;32m\t CST\n\\033[0;35m[\u@\h] \\033[0;33m\w\\033[0;37m\n\\$ "

Note that this prompt is best viewed on an Xterm with white (#F0F0F0)
text on a dark blue (#000060) background rather than Bluecurve's native
black on white.

Be advised that the ANSI sequences occasionally cause erratic newline
behavior near the bottom of an Xterm window. This is purely cosmetic and
has no effect on command line execution.

--Doc


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.