Date: Tue, 23 Sep 2008 11:45:07 -0700 From: Jo Rhett <jrhett@netconsonance.com> To: Jeremy Chadwick <koitsu@FreeBSD.org> Cc: freebsd-ports@FreeBSD.org Subject: Re: Incorrect commandline history with bash Message-ID: <47824C4F-78DE-41EB-A8C4-D0F7282803D0@netconsonance.com> In-Reply-To: <20080922002229.GA12314@icarus.home.lan> References: <20080921215255.GA9622@icarus.home.lan> <34CFC7BB-E7D2-4B34-9D85-70F4C8E718E2@netconsonance.com> <20080922002229.GA12314@icarus.home.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 21, 2008, at 5:22 PM, Jeremy Chadwick wrote: > Everyone lecturing me needs to read, slowly, the INVOCATION part of > the > bash man page. The method I described above should become apparent > afterwards. I'm sorry if you feel I'm lecturing you -- I'm not. I was just trying to note that what you said seems to be backwards in my experience. Moreover, the section of the man page you quoted backed up my analysis: > When bash is invoked as an interactive login shell, or as a non- > interactive shell with the --login option, it > first reads and executes commands from the file /etc/profile, > if that file exists. After reading that file, it > looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, > in that order, and reads and executes commands from > the first one that exists and is readable. The --noprofile > option may be used when the shell is started to > inhibit this behavior. It does not read ~/.bashrc. I have tested this and confirmed its behavior. Now, I will go farther and mention the obvious: > When an interactive shell that is not a login shell is > started, bash reads and executes commands from > ~/.bashrc, if that file exists. However, this file is only read when and if you type "bash" after you are already logged into the system in question. In general, because of the way bash works, it would suggest that putting variables you always want set in the .bashrc is correct, and sourcing it from .bash_profile is also correct. Variables (like terminal settings) which are only applied during login should be set in .bash_profile. Sourcing .bash_profile from .bashrc means you'd need some heft if/then code to avoid playing havoc with your terminal settings. IMHO of course. -- Jo Rhett Net Consonance : consonant endings by net philanthropy, open source and other randomness
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47824C4F-78DE-41EB-A8C4-D0F7282803D0>