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

next in thread | previous in thread | raw e-mail | index | archive | help
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.
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.
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 ;)

Little excerpt from "man bash":
       When bash is invoked as an  interactive  login  shell,  it
       first  reads and executes commands from the file /etc/pro-
       file, if that file exists.  After reading  that  file,  it
       looks  for ~/.bash_profile, ~/.bash_login, and ~/.profile,
       in that order, and reads and executes  commands  from  the
       first  one  that  exists and is readable.  The --noprofile
       option may be used when the shell is  started  to  inhibit
       this behavior.

       When a login shell exits, bash reads and executes commands
       from the file ~/.bash_logout, if it exists.

       When an interactive shell that is not  a  login  shell  is
       started,  bash reads and executes commands from ~/.bashrc,
       if that file exists.  This may be inhibited by  using  the
       --norc  option.   The --rcfile file option will force bash

Malte. 

 > 
 > For more info, see man bash ;)
 > 
 > Greetings,
 > 
 >              Sascha
 > 
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-questions" in the body of the message

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?13765.57486.496079.524320>