change drive

ZIYAD A. M. AL-BATLY zamb at spymac.com
Wed Apr 20 17:15:58 UTC 2005


On Wed, 2005-04-20 at 07:28 -0400, Matthew S-H wrote:
> Ooopsies.  YAY!  I solved a problem by myself and never knew it....
> But I am not quite sure that you/I was right.  "~/.bashrc" is only
> executed for interactive shells (I think---correct me if i'm wrong).
> And therefore, your PATH is only changed for interactive shells.  For
> some scripts, which might benefit from a changed PATH, it would cause
> a problem.
> 
> 
> ~Matt
True.  Here's a trick I've bee using since, like, forever.
Here's what is in my "~/.bashrc":
        [ -r "${HOME}/.profile" ] && source "${HOME}/.profile"
and here's what "~/.profile" contains:
        [ -r /etc/profile ] && . /etc/profile

("~/.profile" does the same thing as "~/.bash_profile".  I don't have
"~/.bash_profile".  The difference between the two is that "~/.profile"
is for all "sh" and compatible shells (like ksh, and bash) while
"~/.bash_profile" is specific for bash only.)

This way, I have the same setting no matter if it's a/an
(non-)interactive and/or (non-)login shell as all use "/etc/profile"
only.  There, I put my default settings for *all* users which is what I
want.  (The only exception is the root user which has the same ~/.bashrc
but different ~/.profile than the rest of the users.)

Ziyad.





More information about the ubuntu-users mailing list