Bash preferences within X
Hey all,
I'm not exactly a noob, and I've searched this, but am looking for something in particular. To get my xterms, aterms, and the like to display the right prompt, ls colors, etc, I've added source /etc/profile to .bashrc This works fine as long as I stay in X. However, logging in to normal text console will display the fortune twice, as it's being read first from /etc/profile, then read again from .bashrc ... Is there a simple way to have .bashrc source /etc/profile if I'm on a non-login shell, but not if I'm logging in from console? --Shade PS -- It's just the idea of redundancy that I'm trying to get around. I realize I could simply put PS1, my aliases and ls -color and so forth, but I'm trying to find a way to read the system-wide /etc/profile file only once, in all cases. |
man bash
|
man bash
/.bashrc The thing is that bash gets invoked differently depending on whether a shell is a login-shell or not... by default in X the shell's aren't login- shells, thus evaluate .bashrc but not /etc/profile. The bash on a console, on the other hand, is a login-shell and will evaluate /etc/profile and ~/bash_profile, ~/.bash_login and ~/.profile (in this order, and stop at the first one found). It shouldn't be using your ~/.bashrc, though, which makes having fortune twice a bit strange. Cheers, Tink |
Right, I thought it was strange...
I'm grokking the bash man page, again... --Shade |
Do you happen to have one of the other
three I mentioned as well, and sourcing that from .bashrc ? Cheers, Tink |
I'm a retard.
I had 'source /etc/profile' in .bash_profile, not .bashrc .bash_profile is read only by a login shell... From the O'Reilly Learning the Bash Shell book: Quote:
--Shade |
Or invoke the xterm (rxvt, konsole, whatever ...) with
a flag that makes it a login-shell as well ;) Cheers, Tink |
I would have done that to begin with, but my instinct was to figure out the workings of it, and why it wasn't doing what I thought it should.
I learned a bit, and that was my goal. Plus it works how I like now. For some reason, I just didn't want login shells for every xterm I'd be opening ;) --Shade |
All times are GMT -5. The time now is 03:44 AM. |