PATH after creating .bashrc

Rainer Müller raimue at macports.org
Sat Sep 11 10:40:36 PDT 2010


On 2010-09-11 19:24 , Eckhard Wiemann wrote:
> On my macbook with OS X 10.6.4 there was no .bashrc in my home dir.

MacPorts adds to .profile (or if it exists to .bash_profile).

> I created it in order to install aliases and added a .bash_profile
> with "source ~/.bashrc", because bash did not read the .bashrc after
> starting the terminal.

.bashrc is not read for login shells. See INVOCATION in the bash man
page. This is normal behavior.

Also it isn't a good idea to always include the whole .bashrc. For
example, any output on stdout would cause protocol violations for scp/sftp.

If you really want to keep it in .bashrc and source that from
.bash_profile, it is comman to add something like this before doing more
stuff which is not required for non-interactive shells:

if [[ $- != *i* ]] ; then
    # Shell is non-interactive.  Be done now!
    return
fi

> Then the "port"-command did not work anymore. I expanded the
> PATH-variable by inserting "/opt/bin" and exported it within the
> .bashrc.

It should not have been in .bashrc as MacPorts recommends to use
.profile (or .bash_profile).

http://guide.macports.org/#installing.shell
http://trac.macports.org/wiki/InstallingMacPorts#a3.Settheshellenvironment

Rainer


More information about the macports-users mailing list