On Mon, Dec 2, 2024 at 10:22 AM GianPiero Puccioni
<gianpiero.pucci...@isc.cnr.it> 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@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to