Em relação ao problema com .bashrc acima:
Na maioria dos sistemas, ~/.bashrc é usado apenas ao iniciar um shell não-login interativo . No entanto, quando você inicia um novo shell, ele geralmente é um shell login interativo . Como esse é um shell login , o .bashrc é ignorado. Para manter o ambiente consistente entre os shells de não login e login, você deve originar o .bashrc de seu .profile ou seu .bash_profile .
Veja o Manual de Referência do Bash, seção 6.2 Arquivos de Inicialização do Bash
Invoked as an interactive login shell,
or with --login
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.
Invoked as an interactive non-login shell
When an interactive shell that is not a login shell is started, Bash reads and executes
commands from ~/.bashrc, if that file exists.
So, typically, your ~/.bash_profile
contains the line
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
after (or before) any login-specific initializations.
No meu Mac (Running Leopard), não havia linha para a origem ~/.bashrc . Eu tive que adicionar essa funcionalidade por conta própria.
Em alguns sistemas e outros sistemas operacionais, .bashrc é proveniente do global /etc/profile ou /etc/bash_profile ou é feito usando os arquivos de modelo de /etc/skel .
Para ser honesto, a distinção entre .bashrc e .bash_profile não é bem compreendida pela comunidade. Quando muitos desenvolvedores dizem "Adicione isso ao seu .bashrc", o que eles realmente querem dizer é "Adicione isso ao seu .bash_profile". Eles querem que a funcionalidade seja adicionada ao seu shell login (que é .bash_profile ), não ao seu shell não-login . Na realidade, isso geralmente não importa e colocar a configuração em .bashrc é aceitável.