From owner-freebsd-questions@FreeBSD.ORG Wed Dec 18 17:27:01 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87828AC for ; Wed, 18 Dec 2013 17:27:01 +0000 (UTC) Received: from blu0-omc4-s37.blu0.hotmail.com (blu0-omc4-s37.blu0.hotmail.com [65.55.111.176]) by mx1.freebsd.org (Postfix) with ESMTP id 4D76011FA for ; Wed, 18 Dec 2013 17:27:01 +0000 (UTC) Received: from BLU0-SMTP372 ([65.55.111.136]) by blu0-omc4-s37.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 18 Dec 2013 09:26:54 -0800 X-TMN: [nXobUHYIsNG0Do7GaNdnEoe5dCiZLE4Y] X-Originating-Email: [drew@mykitchentable.net] Message-ID: Received: from [127.0.0.1] ([69.62.230.77]) by BLU0-SMTP372.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 18 Dec 2013 09:26:51 -0800 Date: Wed, 18 Dec 2013 09:26:45 -0800 From: Drew Tomlinson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Matthew Pherigo , "freebsd-questions@freebsd.org" Subject: Re: System Wide Bash Login Script References: In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 131218-0, 12/18/2013), Outbound message X-Antivirus-Status: Clean X-OriginalArrivalTime: 18 Dec 2013 17:26:51.0835 (UTC) FILETIME=[56EFA8B0:01CEFC16] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 17:27:01 -0000 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 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"