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