Search Path in Bash
Jeff Hinrichs
jlh at cox.net
Mon Mar 1 19:42:37 PST 2004
----- Original Message -----
From: "Peter Risdon" <peter at circlesquared.com>
To: <gerard-seibert at rcn.com>
Cc: <freebsd-questions at freebsd.org>
Sent: Monday, March 01, 2004 2:25 AM
Subject: Re: Search Path in Bash
> Gerard Seibert wrote:
>
> >Peter Risdon writes:
> >
> >
> >>When bash is invoked as an interactive login shell, or as a non-inter-
> >> active shell with the --login option, it first reads and
> >>executes com-
> >> mands from the file /etc/profile, 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.
> >>
> >>
> >>
> >>
> >
> >********** Reply Separator **********
> >Sunday, February 29, 2004 6:01:48 PM
> >
> >Peter, you stated the following:
> >
> >When bash is invoked as an interactive login shell, or as a
non-inter-active
> >shell with the --login option, it first reads and executes commands
> >from the file /etc/profile, 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 credit has been lost along the way, but I was quoting the man page.
>
> >If I am following you correctly, then having a ~/,bashrc, ~/.bashrc or
> >~/.profile file is worthless, if bash reads only the first file that it
> >finds. I am referring in this scenario to the ~/.bash_profile file.
> >
On systems that I have used, I have seen the following:
~/.bash_profile which then executes ~/.bashrc when then executes
/etc/bashrc
the logic being that:
# Personal envrionment variables and startup programs go in
~/.bash_profile
# Personal aliases and functions should go in ~/.bashrc. .
# System wide aliases and functions are in /etc/bashrc.
# System wide environment variables and startup programs are in
/etc/profile
funny thing is that I was just researching that topic today. Now, if
someone sees a glaring problem with the above information please feel free
to let me in on it.
-Jeff
More information about the freebsd-questions
mailing list