Re: Add to $PATH how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-06-04 at 21:35 +0100, Timothy Murphy wrote:
> On Sunday 04 June 2006 13:27, Fülöp Nándor wrote:
> > > I've never really understood what should go in .bashrc
> > > and what in .bash_profile ... ?
> 
> > (1) When you log in, the bash first checks the presence of file
> > ``/etc/profile''. If it exists, the ``bash'' executes the commands listed
> > in ``/etc/profile'' - if this file does not exist, bash does not mind its
> > absence.
> > The ``/etc/profile'' is applied for all users of your system - usually you
> > may modify it as ``root''.
> >
> > (2) Then, the bash reads and executes the commands listed in
> > `.bash_profile' being in home directory. Unlike ``/etc/profile'',
> > ``.bash_profile'' is user-specific!
> > As usually all ordinary users have own home directories, there are as many
> > ``.bash_profile'' files as many users are in your system. E.g. if you are
> > logging in as user ``root'', file ``/root/.bash_profile'' will be executed
> > - if you are logging in as ``joe'', file ``/home/joe/.bash_profile'' will
> > be executed (supposing that home directory of user ``joe'' is
> > ``/home/joe/''), etc. So, if the different users need different settings
> > after their logging in, you may do that by customizing their
> > ``.bash_profile''.
> >
> > (3) For all further shells (after logging in), bash reads and executes the
> > commands in the `.bashrc' file in the home directory of actual user.
> > Commands being in this file run whenever a new shell is started except for
> > the login shell. (This file is also user-specific, like ``.bash_profile''!)
> >
> > So, as a consequence, when you modify the files above, ``bash'' will notice
> > the modification in case of new run of ``bash'' - so, the simplest way to
> > assure the correctness of the modifications, log out and log in again
> > immediately.
> 
> Thanks for the info.
> It's not really clear to me what one would use . bashrc for;
> it seems everything should go in .bash_profile .

No. The key point is that *either* .bash_profile (for login shells)
*or* .bashrc (other shells) is run, not both. See the INVOCATION section
of "man bash". Typically you would set things that are inherited by
subshells (e.g. environment variables) in .bash_profile, and things that
need to be set up in each shell (e.g. aliases) in .bashrc.

Paul.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux