OS-X seems to be almost Unix-like that 99% of my shell hacking works fine. One problem: I can't figure out exactly which file is "source" when the shell starts. I've tried .bashrc, .bash_profile, .profile
I want to define my usual aliases, set the shell prompt, etc.
Something seems to be reading one of the scripts when the first one starts, but I'm not seeing it reproducibly.
I tend to have four or five shell window open at once, and I'd really like to have them automatically have my customizations loaded, without having to do a "source .bashrc" in each one.
Bear Bibeault wrote:When a bash instance starts, it will read .bash_profile in ~.
Changes made to this file after the instance is started will not be retroactive.
No problem with it being once-only.
I guess this asks, when is a bash instance started? Does each "terminal -> Shell -> new window"
start bash again? I ask because its not reproducible for me. Sometimes it works, and sometimes the aliases and prompt are not there. I have not been able to figure out what is happening when it works or when it does not work.
Bear Bibeault wrote:I actually think that there are a number of different config files that bash looks for; e.g. .bashrc
I fixed Bear's typos.
Yes, there are a bunch of them, that are fired off at assorted times. I've never understood exactly when which one goes off.
~/.bashrc, ~/.bash_profile, ~/.profile and some in /etc/
I never had to figure exactly when each was used. I know that in Linux, when you "su" or "login" there are rather strange rules as to which profile script is run. I can't remember details from back when I was really using HP-UX, or assorted BSD or even System 7 Unixes.
Right now, I've copied the files so all three of the ~/ profile-type files are the same. Which works, but its not very elegant.
pie. tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library