Score:0

.bash_profile guidance

in flag

I want to know if there is any guidance I should be following somewhere (maybe from a man page or something) regarding creation of a ~/.bash_profile. By default Ubuntu 18.04 doesn't have one, it just has a .profile file. As I understand it, .profile should just be executing ~/.bashrc. Thus my assumption is that I just need to add a line at the end of my ~.bash_profile to execute ~/.bashrc ; something like:

[[ -f ~/.bashrc ]] && . ~/.bashrc

The reason I ask is because if I create this file, then my .profile file will not be called, so I just need to make sure I'm doing it right.

Second part of my question is, am I correct in understanding ~/.bash_profile should only be invoked ONCE during my login, and then that's it (i.e. sub-sequent interactive shells will just invoke only /etc/bash.bashrc followed by ~/.bashrc?

john smith avatar
in flag
I'm just learning. No goal in sight.
vanadium avatar
cn flag
Does this answer your question? [What goes in ~/.profile and ~/.bashrc?](https://askubuntu.com/questions/1411833/what-goes-in-profile-and-bashrc)
Score:0
ng flag

I had similar questions about six months ago and got some excellent guidance. Please refer to my question and its answers.

I ended up putting in ~/.bashrc everything I needed for working at the command line and putting everything else in ~/.profile. I source ~/.bashrc at the top of ~/.profile and ~/.bash_profile.

If you'd like to look over the current incarnation of my dotfiles, such as they are, you're welcome to do so. They're reasonably well-organized (I think) and well-commented.

terdon avatar
cn flag
Why would you keep a `.bash_profile` file only to have it source `.profile`? `.profile` will always be sourced by any shell instance that would read `.bash_profile`, _unless_ `.bash_profile` exists. So you are creating a file that isn't needed only to have it do exactly what would happen if you hadn't created the file in the first place. Just delete your `.bash_profile` and you will be in the same situation you are in now.
ng flag
@terdon I have no explanation for that. My best guess is that I did it before I understood fully what was going on. As it's not drawn any attention to itself, I've left it alone. I'll consider removing it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.