Date: Wed, 18 May 2005 16:23:47 +0200 From: John Oxley <john@yoafrica.com> To: questions@freebsd.org Subject: Re: Bash: Setting Prompt Message-ID: <20050518142347.GD15624@yoafrica.com> In-Reply-To: <Pine.WNT.4.61.0505180625030.2400@Treneq> References: <Pine.WNT.4.61.0505180625030.2400@Treneq>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050518142347.GD15624>