Re: Bash initialization

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

 



On Mon, Dec 2, 2024 at 10:22 AM GianPiero Puccioni
<gianpiero.puccioni@xxxxxxxxxx> wrote:
>
> On 01/12/2024 19:52, Joe Wulf via users wrote:
> >   For what it is worth, locally changing things like PS1 and environment variable assignments should be made in .bashrc, not .bash_profile.
> >
> When I started with Unix, a long time ago, it was Env Var in profile and aliases
> and other stuff in *rc depending on your shell.

This has always been and is correct.
The explanation lies in when the startup files are executed.

~/.bashrc gets executed by each interactive shell
Therefore here belong
- functions that, by default, are not exported by/cannot be inherited
from the parent process
- aliases that are not exported by/cannot be inherited from the parent process
- prompt - PS1 shell variable (not an environment variable) - set by
bash, can be modified by the user
Note, that environment variables are inherited from the parent process
and need not be set here.

~/.bash_profile (or ~/.bash_login or ~/.profile) gets executed by
login shell/at session start-up
Therefore setting environment variables belongs here.
Also ~/.bashrc needs to be executed here in case the login shell is interactive.

greg
-- 
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux