Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 1998 19:33:29 +0200 (MET DST)
From:      Sascha Schumann <sas@schell.de>
To:        Malte Lance <malte.lance@gmx.net>
Cc:        William Woods <wwoods@cybcon.com>, "freebsd-questions@FreeBSD.ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: BASH prompt question
Message-ID:  <Pine.LNX.3.96.980803192418.24458B-100000@www.schell.de>
In-Reply-To: <13765.57486.496079.524320@neuron.webmore.de>

next in thread | previous in thread | raw e-mail | index | archive | help


On Mon, 3 Aug 1998, Malte Lance wrote:

> Sascha Schumann writes:
>  > On Sun, 2 Aug 1998, William Woods wrote:
>  > 
>  > > I would like to make my bash prompt show a little more info, like what dir the
>  > > user is in. How would I do this?
>  > 
>  > Edit /etc/profile and insert at the end:
>  > 
>  > test "$SHELL" = "/bin/bash" && test -e ~/.bashrc && source ~/.bashrc
>  > 
>  > Or, if that looks too ugly to you:
>  > 
>  > if [ "$SHELL" = "/bin/bash" -a -e ~/.bashrc ] ; then
>  > 	source ~/.bashrc
>  > fi
>  > 
>  > Then you can put all your personal stuff (in case your system is used by
>  > more than one) in your ~/.bashrc:
>  > 
>  > PS1='\u@\h:`pwd -P` $ '
>  > export PS1
> 
> Sorry to drop in.
> ~/.bash_profile and ~/.bashrc are sourced by bash itself when they
> exist. No need to source them via a system-rc.

You should have read your excerpt from the man page better ;o)

bashrc will only be sourced automatically if you start e.g. a xterm which
uses a interactive shell but is not a login shell. 

> Further bash is in the ports-collection and when installing the bash
> as a port or package, it will be installed in /usr/local/bin by
> default.

I'm used to compile everything myself ;) IMO /usr/local/bin is a somewhat
strange place for a login shell, it should be in /bin which is normally on
the root filesystem.

> So all this guy has to do is to create and edit ~/.bashrc for
> non-login-shells and ~/.bash_profile for login-shells.
> Yes Sascha, your answer is absolutely correct just a little
> OS-specific ;)

May I add sth here: To save time, space and redundant code ;) it's usually
better to put the most things (e.g. aliases, vars specific to that login)
in bashrc and to source it from /etc/profile or bash_profile.

Greetings,
               Sascha


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.96.980803192418.24458B-100000>