Date: Wed, 18 Dec 2013 09:26:45 -0800 From: Drew Tomlinson <drew@mykitchentable.net> To: Matthew Pherigo <hybrid120@gmail.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: System Wide Bash Login Script Message-ID: <BLU0-SMTP372E34C3B74A12DF26B7EC7B3DA0@phx.gbl> In-Reply-To: <A2F77DDA-BD32-4CBF-BA56-9DF2BF43DEE8@gmail.com> References: <BLU0-SMTP311BA69BBE6C3820F674C80B3DB0@phx.gbl> <A2F77DDA-BD32-4CBF-BA56-9DF2BF43DEE8@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/17/2013 3:56 PM, Matthew Pherigo wrote: > Hi Drew! > > Believe it or not, systemwide bashrc sourcing isn't actually built-in to bash by default (though in my opinion, it should be). This behavior of global config sourcing actually comes from default /etc/profile files that come with Linux distros. Since FreeBSD uses csh/tcsh by default, of course, it comes with no such thing. However, it's fairly easy to add. The following snippet of code goes into your /etc/profile: > > if [ "$PS1" ]; then > if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then > if [ -f /usr/local/etc/bash.bashrc ]; then > fi > fi > fi > > If the shell is interactive, is a bash shell, and the file /usr/local/etc/bash.bashrc exists, it sources it. > > This is the snippet of code I use; I think it was originally from Debian. > --Matt Hi Matt, Thanks for your reply. The snippet of code you provided does work. However, I remain confused. I have a box I built a couple of years ago which is currently at 9.1. I don't recall how I got bash login scripts working on that one but it appears that I put my commands in /usr/local/etc/bashrc. The /etc/profile on that box is the default where everything is commented out. So no code is needed on that box to get the commands in /usr/local/etc/bashrc to run when logging in. I'm just trying to understand why the /etc/profile trick is required on this new box I built but not the old? Thanks, Drew > >> On Dec 17, 2013, at 5:28 PM, Drew Tomlinson <drew@mykitchentable.net> wrote: >> >> 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 found 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 get the expected behavior. >> >> What am I missing? >> >> Thanks, >> >> 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.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BLU0-SMTP372E34C3B74A12DF26B7EC7B3DA0>