Sourcing bash_profile in Endeavour OS

I’m trying to understand something and my searches are turning up no useful results.

Basically I brought over a bunch of bash stuff from my previous Fedora installation. In Fedora my bash_profile was used and so anything in ~.bash_functions folder where available as commands when I launched a terminal. But in Endeavour I discovered this doesn’t work. I just figured out I need to run ‘bash -l’ and then all my bash functions are sourced and added as available commands. But this bugs me because now I need to remember to run bash -l every time I open a terminal. Granted this is minor but I’d like to know what the advantage of starting a non logged in terminal is and how I can make bash -l the default mode that a terminal open in. Unless there is some good reason not to do this.

Keen to hear your thoughts. I’m sure this is a matter of opinion but mostly I’m genuinely interested in learning the pros and cons and how to make my bash life better.

TLDR answer: Your functions are in the wrong place.

Full answer:
When you open a terminal, you get an interactive non-login shell. In this case, ~/.bash_profile should not get executed.

If you have functions, you should trigger them from ~/.bashrc, not ~/.bash_profile.

By default, on Arch(and EOS), ~/.bash_profile does nothing but source ~/.bashrc. That basically makes your functions available in both login shells and non-login shells.

Apologies for never replying here. My quick solution was to just run bash -l and then I get all my functions. I appreciate the input. Will adjust accordingly.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.