From owner-freebsd-questions@FreeBSD.ORG Wed May 18 14:24:13 2005 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 98F5216A4D0 for ; Wed, 18 May 2005 14:24:13 +0000 (GMT) Received: from cortizone.yoafrica.com (cortizone.yoafrica.com [196.44.176.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3BB8C43D4C for ; Wed, 18 May 2005 14:24:12 +0000 (GMT) (envelope-from sysjo@hades.yoafrica.com) Received: from [196.44.188.50] (helo=hades.yoafrica.com ident=postfix) by cortizone.yoafrica.com with esmtp (Exim 4.50 (FreeBSD)) id 1DYPSf-0000kl-CP for questions@freebsd.org; Wed, 18 May 2005 16:23:59 +0200 Received: by hades.yoafrica.com (Postfix, from userid 1001) id 81EA062C5; Wed, 18 May 2005 16:23:47 +0200 (CAT) Date: Wed, 18 May 2005 16:23:47 +0200 From: John Oxley To: questions@freebsd.org Message-ID: <20050518142347.GD15624@yoafrica.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Spam-Score: -2.8 (--) X-Spam-Report: Spam detection software, running on the system "cortizone.yoafrica.com", hasmessagelabel similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Wed, May 18, 2005 at 06:26:53AM -0400, Gerard> # Set the prompt to display the 'user@host' and the working > #> case 'id -u' in > 0) PS1="${PS1}# ";; > *) PS1="${PS1}$ ";; > esac [...] Content analysis details: (-2.8 points, 5.0 required) pts rule name description -------------------------------------------------- -2.8 ALL_TRUSTED Did not pass through any untrusted hosts Subject: Re: Bash: Setting Prompt 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: Wed, 18 May 2005 14:24:13 -0000 On Wed, May 18, 2005 at 06:26:53AM -0400, Gerard Seibert wrote: > I have the following in my '.bash_profile' file. > # > # Set the prompt to display the 'user@host' and the working > # directory with a '#' for root and '$' for user. > # > PS1="\u@\h \w " > case 'id -u' in > 0) PS1="${PS1}# ";; > *) PS1="${PS1}$ ";; > esac Okay you can do that or if you are using bash 2.05 or above, just do this PS1='\u@\h \w \$ ' The \$ is clever and is a # if you are root, and $ if you are not. This is from my ~/.bashrc export PS1='\[\e]2;\h:\w\a\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]\$ ' -- John Oxley Senior Systems Administrator Yo!Africa E-Mail: john@yoafrica.com Tel: +263 4 858404 ext 2017 Cell: +263 91 335 109