0

On my OS X system, when I use a subshell (for example with screen), the settings in my .bash_profile are inherited, but on Ubuntu, they are not, and in order to get the same behavior I have on OS X I have to add

source ~/.bash_profile

to the start of my .bashrc.

Does Ubuntu (Linux) handle the relationship between .bash_profile and .bashrc and their use in subshells differently from OS X (BSD)? Is there an Ubuntu setting that makes it behave like OS X in this regard so that I can avoid the above line?

orome
  • 101
  • 4
  • @DavidFoerster: So OS X (BSD) and Ubuntu (Linux) behave exactly the same, and I should look to the contents of my `/etc/profile` and `~/.profile` to see what differs there between the two systems I have? – orome May 24 '16 at 12:30
  • @DavidFoerster: It looks like [this](http://askubuntu.com/q/432508/231332) may also be (even more) relevant; and be the start of an answer here. – orome May 24 '16 at 12:31
  • I tend to believe that the profile and shell start-up script behaviour is standardized for all *nices (e. g. BSD and Linux, OS X and Ubuntu). Ultimately that would be a question worth asking on [Unix.SE] though. – David Foerster May 24 '16 at 12:51
  • @DavidFoerster: Maybe. But I can't reconcile that with what I'm seeing. On OS X, the settings from my `~/.bash_profile` are in effect when I `screen`, and those in `~/.bashrc` are as well (I get the effect of the former followed by the latter). But on Ubuntu, I get only the latter (`~/.bash_profile` settings are not used). Perhaps there's a `screen` setting on Ubuntu that does not inherit the parent shell's settings? – orome May 24 '16 at 15:13
  • @DavidFoerster: I think I've found half of the answer [here](http://apple.stackexchange.com/q/119711/439): on OS X `.bashrc` is *not* sourced by `.bash_profile`. That leaves the questions of how `screen` inherits (a) inherits all of `.bash_profile` (when Ubuntu does not) and (b) also reads `.bashrc`. – orome May 24 '16 at 16:03

0 Answers0