From owner-freebsd-questions Mon Apr 26 10:20:45 1999 Delivered-To: freebsd-questions@freebsd.org Received: from europe.std.com (europe.std.com [199.172.62.20]) by hub.freebsd.org (Postfix) with ESMTP id AAF2815162 for ; Mon, 26 Apr 1999 10:20:41 -0700 (PDT) (envelope-from lowell@world.std.com) Received: from world.std.com by europe.std.com (STD1.2/BZS-8-1.0) id NAA00523; Mon, 26 Apr 1999 13:20:38 -0400 (EDT) Received: by world.std.com (TheWorld/Spike-2.0) id AA15493; Mon, 26 Apr 1999 13:20:37 -0400 Date: Mon, 26 Apr 1999 07:31:23 -0500 To: "Mike Roberts" , freebsd-questions@freebsd.org Subject: [freebsd-questions] bash startup scripts X-No-Archive: yes References: <00a001be8f9d$f9182860$0100a8c0@kermit> From: Lowell Gilbert In-Reply-To: "Mike Roberts"'s message of Sun, 25 Apr 1999 21:31:23 -0700 Message-Id: Lines: 36 X-Mailer: Gnus v5.5/Emacs 20.2 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG "Mike Roberts" writes: > I'm trying to make bash's startup files work, and the behavior that my > installation exhibits does not seem to match the documentation that I have: > > - The book, "The Complete FreeBSD" claims that bash executes '.profile', and > then '.bashrc'. > - The bash man page claims that it executes '.bash_profile' on login, and > '.bashrc' for each shell (login shell also?). > - My installation (the package installed with sysinstall) executes > '.profile' on login, and executes '.bashrc' only when I execute bash again > from the login shell. > > Which behavior is correct? What do to obtain the proper behavior? I don't have "The Complete FreeBSD," but you are misquoting the bash man page. What your installation does sounds correct, although there are a few details that should be explained a little further. When a login shell starts, bash first executes /etc/profile, if it exists. After that, it executes *exactly* *one* *of* ~/.bash_profile, ~/.bash_login, and ~/.profile. The first one of those that's found, wins. The others won't be checked. .bashrc is executed only by interactive shells that are *not* login shells. Personally, I don't find this behaviour helpful, so I have .bash_login automatically drag in .bashrc; but then, the distinction between login and non-login shells isn't helpful (i.e., you don't normally *get* a login shell) when you're running under xdm. If "The Complete FreeBSD" claims that bash automatically executes both '.profile' and '.bashrc' for the *same* shell, then it's wrong, and I'm sure Greg Lehey will want to fix that. Be well. Lowell Gilbert To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message