Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2013 17:56:07 -0600
From:      Matthew Pherigo <hybrid120@gmail.com>
To:        Drew Tomlinson <drew@mykitchentable.net>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: System Wide Bash Login Script
Message-ID:  <A2F77DDA-BD32-4CBF-BA56-9DF2BF43DEE8@gmail.com>
In-Reply-To: <BLU0-SMTP311BA69BBE6C3820F674C80B3DB0@phx.gbl>
References:  <BLU0-SMTP311BA69BBE6C3820F674C80B3DB0@phx.gbl>

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

Believe it or not, systemwide bashrc sourcing isn't actually built-in to bas=
h by default (though in my opinion, it should be). This behavior of global c=
onfig sourcing actually comes from default /etc/profile files that come with=
 Linux distros. Since FreeBSD uses csh/tcsh by default, of course, it comes w=
ith no such thing. However, it's fairly easy to add. The following snippet o=
f code goes into your /etc/profile:

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" !=3D "/bin/sh" ]; then
    if [ -f /usr/local/etc/bash.bashrc ]; then
=00=00=00=00=00=00. /usr/local/etc/bash.bashrc
    fi
  fi
fi

If the shell is interactive, is a bash shell, and the file /usr/local/etc/ba=
sh.bashrc exists, it sources it.

This is the snippet of code I use; I think it was originally from Debian.=20=

--Matt

> On Dec 17, 2013, at 5:28 PM, Drew Tomlinson <drew@mykitchentable.net> wrot=
e:
>=20
> I'm trying to figure out where the system wide bash login script should be=
 for FBSD 9.2.  I've tried /etc/profile, /usr/local/etc/profile, and I even f=
ound reference to creating a .bashrc file in home directories, testing for /=
usr/local/etc/profile, and then calling it if it exists.  None of this seems=
 to work.  However if I paste the contents into a shell after logging in, I g=
et the expected behavior.
>=20
> What am I missing?
>=20
> Thanks,
>=20
> Drew
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.or=
g"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A2F77DDA-BD32-4CBF-BA56-9DF2BF43DEE8>