On Nov 23, 2005, at 4:37 PM, Chris Barker wrote:

> I've never been able to figure out when to use .profile vs .bashrc, but
> I thought it had to do with only one of them being run when a subshell
> was started, or something like that.
>
That's basically it. For a login shell, .profile is run; you can use 
.bash_profile or .bash_login instead, if you prefer. For an interactive 
nonlogin shell, .bashrc is run. So, .bashrc will be run for a subshell.

> I do note that on both my OS-X and Linux boxes, /etc/profile sources
> bashrc, and uses bash syntax, so it sure looks like a bash-specific
> config file to me.
>
At least on 10.3.9 (which I'm using at the moment), the contents of 
/etc/bashrc and /etc/profile work fine in sh as well as bash. For sh 
(and ksh), /etc/profile and .profile should both be run, so you can 
think of .bash_profile as a way to get distinct profiles for bash and 
sh (or ksh). It could well make sense to source .profile inside 
.bash_profile.

None of that should conflict with csh, tcsh, or zsh, as I understand it.

To address the original point of where to set the path, I would put
        export PATH=/usr/local/bin:$PATH
in one of .profile, .bash_profile, or .bashrc, depending on exactly 
what you want. Focusing on bash only, a reasonable approach would be to 
put the path and other things for all interactive shells in .bashrc and 
add
        source .bashrc
to .bash_profile. If you also use sh or ksh interactively, some further 
thought might be in order.

For tcsh, I'd put
        set path = (  /usr/local/bin $path)
in .cshrc or .tcshrc.

Zsh users already know what they're doing, I'm sure.

Michael

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to