Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Easier use of X11 in bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easier use of X11 in bash
Authored by: GaelicWizard on Oct 30, '03 04:52:14PM

Some tips on bash from a fellow rookie:

The reason that .bashrc is not sourced when you open a new terminal, but it is when you open an xterm, is that terminal.app launches a "login shell" by default, where as xterm does not.

What's the diff? In a "login shell" bash sources ~/.bash_profile or ~/.bash_login or ~/.profile (whichever one it finds first), and (t)csh would source ~/.login. This is primarily for setting up things like PATH and other env variables that should really only need to be set once. For non-login shells, bash sources only ~/.bashrc ((t)csh sources ~/.(t)cshrc in both) to set up things that are for the general use shell, or a shell script, this means generally aliases and setting up the prompt line etc. the login shell is, by definition, only run by a user, so you can get away with printing loads of stuff to the screen, where in general shell a shell script might misunderstand the screen output.

I use the amazingly useful and wonderful 'screen' program to multiplex my terminal screens, and this also makes sure that both ~/.bash_profile AND ~/.bashrc are sourced since bash starts as a login shell in terminal.app (sourcing ~/.bash_profile) and then screen takes over and in turn loads a normal shell (which sources ~/.bashrc).

Just thought I'd share this little info 'cuz I noticed that the original author source'd ~/.bashrc in his ~/.bash_profile. :-)

JP

---
Pell



[ Reply to This | # ]