Bash Does Not Source /etc/profile

Gary Aitken freebsd at dreamchaser.org
Thu Aug 20 20:05:05 UTC 2020


On 8/20/20 12:42 PM, Ottavio Caruso via freebsd-questions wrote:
> On 20/08/2020 19:37, Drew Tomlinson wrote:
>> I performed an binary upgrade from 12.0-p3 to 12.1-p8 and
>> recompiled all ports.  My shell is set to /usr/local/bin/bash in
>> /etc/passwd.  One thing that's puzzling is that /etc/profile is no
>> longer sourced when I log in. However, if I source /etc/profile
>> after I log in, there are no errors.
>> 
>> I have verified my shell is both login and interactive with these
>> code snippets I found on the web:
>> 
>> [drew at blackcloud ~]$ shopt -q login_shell && echo 'Login shell' ||
>> echo 'Not login shell' Login shell [drew at blackcloud ~]$ [[ $- ==
>> *i* ]] && echo 'Interactive' || echo 'Not interactive' Interactive
>> 
>> What else should I check?
> 
> Copy ~/.profile to ~/.bash_profile and source /etc/profile from
> there.

I don't *think* a copy should be necessary:

$ strings $(which bash) | grep profile
noprofile
/etc/profile
~/.profile
~/.bash_profile
$ strings $(which bash) | grep shrc
~/.bashrc

But to the original question, why are you expecting errors?

Gary


More information about the freebsd-questions mailing list