[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about .bash_profile
From: |
Kerin Millar |
Subject: |
Re: question about .bash_profile |
Date: |
Thu, 01 Feb 2024 11:39:27 +0000 |
User-agent: |
Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 |
On Thu, 1 Feb 2024, at 11:09 AM, alex xmb sw ratchev wrote:
> is it as equivalent as .profile ?
Please refer to INVOCATION in the manual. Bash looks for ~/.bash_profile,
~/.bash_login and ~/.profile in that order, reading and executing commands from
the first of those three files that it finds. So, if you want for bash to
recognise ~/.profile, you have to ensure that ~/.bash_profile does not exist.
One potential benefit of using ~/.profile is that it will also be read by other
POSIX sh implementations, such as dash. Therefore, it should only contain code
that is compatible with sh. I tend to define environment variables in
~/.profile before having it source ~/.bashrc, if appropriate.
if [ "$BASH" ] && [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
--
Kerin Millar