From owner-freebsd-questions@FreeBSD.ORG Mon Feb 2 07:07:38 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E5C6516A4D6 for ; Mon, 2 Feb 2004 07:07:38 -0800 (PST) Received: from exgw2.lumeta.com (exgw2.lumeta.com [65.198.68.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id B126743D62 for ; Mon, 2 Feb 2004 07:07:14 -0800 (PST) (envelope-from criley@lumeta.com) Received: from ingw2.lumeta.com (h65-246-245-2.lumeta.com [65.246.245.2]) by exgw2.lumeta.com (Postfix) with ESMTP id 4E0625F90A1; Mon, 2 Feb 2004 10:01:18 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by ingw2.lumeta.com (Postfix) with ESMTP id CDB9551977; Mon, 2 Feb 2004 10:07:13 -0500 (EST) Received: from ingw2.lumeta.com ([127.0.0.1]) by localhost (ingw2.lumeta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 45632-10; Mon, 2 Feb 2004 10:06:55 -0500 (EST) Received: from lucy.corp.lumeta.com (lucy.corp.lumeta.com [65.246.245.10]) by ingw2.lumeta.com (Postfix) with ESMTP id 5B6DA51968; Mon, 2 Feb 2004 10:06:55 -0500 (EST) Received: from lumeta.com (criley1.corp.lumeta.com [65.246.246.84]) by lucy.corp.lumeta.com (Postfix) with ESMTP id 4DDBAA8B37; Mon, 2 Feb 2004 10:06:55 -0500 (EST) Message-ID: <401E673B.6030201@lumeta.com> Date: Mon, 02 Feb 2004 10:05:31 -0500 From: Chris Riley Organization: Lumeta Corp. User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6b) Gecko/20031209 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nathan Kinkade References: <0HSG002S0E0D8R@mail.etat.lu> <20040202144617.GL3937@npkfbsd> In-Reply-To: <20040202144617.GL3937@npkfbsd> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at lumeta.com cc: Didier WIROTH cc: freebsd-questions@freebsd.org Subject: Re: customize set prompt question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2004 15:07:39 -0000 FWIW this is what I use in my .bashrc. The contol codes are for an ANSI terminal, the shell doesn't care what to use. The \[ and \] are bash specific, you'll want to remove them for csh. BLACK="\[\e[0;30m\]" BLUE="\[\e[0;34m\]" GREEN="\[\e[0;32m\]" CYAN="\[\e[0;36m\]" RED="\[\e[0;31m\]" PURPLE="\[\e[0;35m\]" BROWN="\[\e[0;33m\]" LIGHT_GRAY="\[\e[0;37m\]" DARK_GRAY="\[\e[1;30m\]" LIGHT_BLUE="\[\e[1;34m\]" LIGHT_GREEN="\[\e[1;32m\]" LIGHT_CYAN="\[\e[1;36m\]" LIGHT_RED="\[\e[1;31m\]" LIGHT_PURPLE="\[\e[1;35m\]" YELLOW="\[\e[1;33m\]" WHITE="\[\e[1;37m\]" NO_COLOR="\[\e[0m\]" who am i | grep '^root' > /dev/null if [ $? = 0 ] ;then COLOR=$RED else COLOR=$LIGHT_GREEN fi export PS1="$COLOR\u$NO_COLOR:$YELLOW\w$NO_COLOR\$ " Nathan Kinkade wrote: > On Mon, Feb 02, 2004 at 11:48:13AM +0100, Didier WIROTH wrote: > >>Hi, >> >>I would like to colorize this prompt: >>set prompt="@%m:%~# " >> >>How do I have to modify the prompt so that the entire prompt is of "red" >>color. >>Only the prompt should be red, not what is typed or the results of any >>output. >> >>many thanks > > > Does csh understand ansi escape sequences? If so you could try this: > > $ set prompt="\[\e[1;31m\]@%m:%~# \[\e[m\]" > > I don't know if this will work in csh, but it definitely works in bash. > For bash it would be: > > $ export PS1="\[\e[1;31m\]@%m:%~# \[\e[m\]" > > Nathan