From owner-freebsd-questions@FreeBSD.ORG Thu May 15 04:10:41 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44512106566B for ; Thu, 15 May 2008 04:10:41 +0000 (UTC) (envelope-from raghu@mri.ernet.in) Received: from hrimail.hri.res.in (hrimail.hri.res.in [210.212.50.7]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6598FC1C for ; Thu, 15 May 2008 04:10:40 +0000 (UTC) (envelope-from raghu@mri.ernet.in) Received: from ipc2.mri.ernet.in (unknown [192.168.3.2]) by hrimail.hri.res.in (Postfix) with ESMTP id 2F0AE97E53; Thu, 15 May 2008 09:46:43 +0530 (IST) Received: from ipc2 (localhost [127.0.0.1]) by ipc2 (Postfix) with SMTP id 4FF1A234D0; Thu, 15 May 2008 09:40:31 +0530 (IST) Received: from riemann.mri.ernet.in (riemann.mri.ernet.in [192.168.3.122]) by ipc2.mri.ernet.in (Postfix) with ESMTP id 2FF80234CF; Thu, 15 May 2008 09:40:31 +0530 (IST) Received: from riemann.mri.ernet.in (localhost [127.0.0.1]) by riemann.mri.ernet.in (8.13.6/8.13.6) with ESMTP id m4F447Ya005361; Thu, 15 May 2008 09:34:07 +0530 (IST) (envelope-from raghu@riemann.mri.ernet.in) Received: (from raghu@localhost) by riemann.mri.ernet.in (8.13.6/8.13.6/Submit) id m4F43rg0005360; Thu, 15 May 2008 09:33:53 +0530 (IST) (envelope-from raghu) From: "N. Raghavendra" To: "Montag" In-Reply-To: <1210810823.5782.1253224263@webmail.messagingengine.com> (montag@activeattack.com's message of "Wed, 14 May 2008 19:20:23 -0500") References: <1210810823.5782.1253224263@webmail.messagingengine.com> X-Organization: Harish-Chandra Research Institute (HRI) X-Address: Chhatnag Road, Jhusi, Allahabad 211 019, India X-URL: http://www.mri.ernet.in/ and http://www.retrotexts.net/ X-Phone: +91 (532) 2667 509, 2667 318, 2667 578, 2567 746, 2567 747 X-Fax: +91 (532) 2667 576, 2567 748, 2567 444, 2568 036 X-OpenPGP-Key-ID: 0x03618806 X-OpenPGP-Key-Fingerprint: C75D D0AF 457E 7454 BEC2 37AD C6E1 0407 0361 8806 X-OpenPGP-Public-Key-Available-At: http://www.keyserver.net/ Date: Thu, 15 May 2008 09:33:53 +0530 Message-ID: <86tzh0usba.fsf@riemann.mri.ernet.in> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd questions Subject: Re: Configuring Bash X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "N. Raghavendra" List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 May 2008 04:10:41 -0000 At 2008-05-14T19:20:23-05:00, Montag wrote: > I've got the following in the .bash_profile of a basic user account: > > # set prompt [user@host--/dir] $ (# for root) > PS1 = ' [\u@\h--\w] ' > case `id -u` in > 0) PS1='${PS1} # ';; # root > *) PS1='${PS1} $ ';; # everyone else I don't use `bash' much, but that `case' expression is probably unnecessary. According to bash(1) [section on "Prompting"], the special character `$' can be used in prompt-strings: "\$ if the effective UID is 0, a #, otherwise a $" So, something like export PS1="[\u@\h--\w]\$ " in `~/.bashrc' should produce the prompt you want. Raghavendra. -- N. Raghavendra | http://www.retrotexts.net/ Harish-Chandra Research Institute | http://www.mri.ernet.in/ See message headers for contact and OpenPGP information.