What you've observed is correct behavior.
Things like PATH enhancements/changes belong in .bash_profile (as that file has 'generally' replaced the .profile functionality of yesteryear). Also, putting new things into the PATH variable, should always be done at the end, not the beginning.
Thus: PATH="x:${PATH}" is bad form and introduces potential security vulnerabilities.
And: PATH="${PATH}:x" is correct.
Yes, PS1 is also an environment variable (PATH is too) that should be set and/or adjusted to suit a local user in their .bashrc.
Also, yes, aliases and functions should be established/assigned in .bashrc, too.
Thank you.
R,
-Joe
On Monday, December 2, 2024 at 06:52:34 AM EST, Tim <ignored_mailbox@xxxxxxxxxxxx> wrote:
On Sun, 2024-12-01 at 18:52 +0000, 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.
Long ago I remember trying to figure out where to put PS1, since it did
work in either one, but it wasn't clear where it really belonged.
On one PC I have this:
---------------------------------------------------
[tim@rocky ~]$ cat .bashrc# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PS1="\[\e[44m\][\u@\h \w]\$\[\e[0m\] "
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
---------------------------------------------------
(Root gets a red highlight, instead, it makes a good warning, as well
as making it easier to find the various prompts and inputs when
scrolling through.)
And this:
---------------------------------------------------
[tim@rocky ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
---------------------------------------------------
But... isn't PS1= an environment variable? And the .bash_profile
comment would seem to suggest they belong in there.
--
uname -rsvp
Linux 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Boilerplate: All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.
> For what it is worth, locally changing things like PS1 and
> environment variable assignments should be made in .bashrc, not
> .bash_profile.
Long ago I remember trying to figure out where to put PS1, since it did
work in either one, but it wasn't clear where it really belonged.
On one PC I have this:
---------------------------------------------------
[tim@rocky ~]$ cat .bashrc# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PS1="\[\e[44m\][\u@\h \w]\$\[\e[0m\] "
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
---------------------------------------------------
(Root gets a red highlight, instead, it makes a good warning, as well
as making it easier to find the various prompts and inputs when
scrolling through.)
And this:
---------------------------------------------------
[tim@rocky ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
---------------------------------------------------
But... isn't PS1= an environment variable? And the .bash_profile
comment would seem to suggest they belong in there.
--
uname -rsvp
Linux 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Boilerplate: All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.
-- _______________________________________________ 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