Re: how to change environment variable permanently

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

 





On 25 Jun 2022, at 12:36, George N. White III <gnwiii@xxxxxxxxx> wrote:


On Fri, Jun 24, 2022 at 7:28 PM Barry <barry@xxxxxxxxxxxxxxxx> wrote:

On 24 Jun 2022, at 16:36, Roger Heflin <rogerheflin@xxxxxxxxx> wrote:


Trick is add this around the path add.  

If [ $path_add -ne 1 ] ; then
Path addition code
Path_add=1
Fi

That only runs it once.

This is a work around for using ,bashrc when .bash_profile is where this should be done.

I think that advice goes back to a time before modern GUI's.  Now many users have never
encountered a terminal, and distros vary widely in the use of ~/.bashrc, ~/.bash_profle, and
~/.profile.


Actually they are fixing the problem of inheriting .bash_profile from the login to
the gui session to running the shell on login mode. So no this is not out of date
advice.


On my Fedora 35 box, ~/.bash_profile is:

  ----------------------------------ser
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

That has been required since the beginning of time.

You always source .bashrc in the profile.

The reason that you do not set important things in the .bashrc is that if you do
that you cannot override them from the command line.

For example if you set PATH in .bashrc you cannot then change for any sub shells from the command line.

Barry


# User specific environment and startup programs
  ---------------------------

Some distros have complicated ~/.bashrc or `/.bash_profile files with a section devoted to
interactive sessions.   This led to issues where users added settings in the wrong section.  
I often ask users to run a failing command in a terminal where they may see messages
that their GUI tools hide, but getting different behaviours between GUI and terminal has
become a problem.

--
George N. White III

_______________________________________________
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 on the list, report it: https://pagure.io/fedora-infrastructure
_______________________________________________
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 on the list, report it: https://pagure.io/fedora-infrastructure
[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