I upgraded to 10.3 some time ago, but since I didn't do a clean install my existing user was still set to tcsh for its default shell. Since the 10.3 default is bash, I decided to change my shell using NetInfo. So now I'm using bash, but it doesn't execute my .bashrc file. The only thing I have in there is 1 alias command. The command works fine when typed manually into a running shell, but it's never there automatically.
Any ideas? I use the CLI for stuff like concatenating files but don't mess around with anything behind the scenes. Everything should be "clean". The official GNU bash manual doesn't seem to specificy any special format for the .bashrc file.
Thanks all!
scaryfish
04-02-2004, 02:46 PM
Try sticking
~/.bashrc
in /etc/bashrc - that worked for me (each users .bashrc doesn't get run by default).
giskard22
04-02-2004, 03:04 PM
Ok, tried it. After I made the modification, the next shell I opened gave me a "permission denied" error at the top. So I added user execute permission to .bashrc. This time the error went away, but the alias still wasn't made.
Is there some special format required for the .bashrc file? Mine is the following (in its entirety):
alias dir="ls -al"
mervTormel
04-02-2004, 04:57 PM
what you want to do is load the ~/.bashrc file from ~/.bash_profile
if [ -f ~/.bashrc ]; then source ~/.bashrc ; fi
the source command reads and executes the commands in the file specified
if you don't have ~/.bash_profile, create it.
refer to man bash 'invocation' section where, after deciphering, you'll know that login shells (what's that?) "sources" the file at ~/.bash_profile and that subshells (huh?) source ~/.bashrc
so, a login shells need to specifically source ~/.bashrc
subshells don't load ~/.bash_profile, they load ~/.bashrc
--
if it were easy, we wouldn't call it code, and this is easy when you know how it works
;]
giskard22
04-02-2004, 05:02 PM
Thanks, that works.
I remembering seeing that sort of thing in the material I read online. The missing link for me was in defining what a "login shell" is versus a regular "interactive shell". It sounds like the first shell created through a particular Terminal window is a login shell, which makes sense if you ignore that fact that you've logged into the computer via a GUI also. :)