Bash does not source /etc/bash/bashrc for login shells. Steps to reproduce: 1. Connect to Gentoo system via SSH and log in. 2. Notice prompt does not display in color. 3. "su -" (the hyphen means login shell). Prompt still not in color. 4. Exit from su -. 5. "su" (without the hyphen means non-login shell). Prompt is now in color. I have also thrown in variable exports before and after the test for interactive shell in /etc/bash/bashrc. Neither before or after variable is set for login shells. Both variables are set for non-login shells. Expected result: Bash always sources /etc/bash/bashrc regardless of whether it is invoked as a login shell.
Created attachment 57693 [details] /etc/bash/bashrc This should be identical to the distributed /etc/bash/bashrc.
mattw@gentoo ~ $ echo ${use_color} mattw@gentoo ~ $ su - mattw Password: mattw@gentoo ~ $ echo ${use_color} mattw@gentoo ~ $ logout mattw@gentoo ~ $ su mattw Password: mattw@gentoo ~ $ echo ${use_color} true
sounds like your /etc/profile still refers to /etc/bashrc
Indeed my /etc/profile was still referring to /etc/bashrc. I remerged baselayout and now it uses /etc/bash/bashrc. I have no clue why /etc/profile wasn't updated when I originally updated to baselayout-1.11.11-r3. I hasn't touched it. Thanks though!
that is weird ... i put 1.11.11-r3 in specifically to update /etc/profile :x
Im haveing the exact same problem. since updateing to emerge bash baselayout -p These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] app-shells/bash-3.0-r11 [ebuild R ] sys-apps/baselayout-1.11.11-r3 I have no color prompt I have " . /etc/profile " and I have .bash_profile and .bashrc in home. ANd I just noticed this. root@tester ~ # . .bashrc root@tester ~ # . /etc/profile root@tester ~ # emerge baselayout -p These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] sys-apps/baselayout-1.11.11-r3 root@tester ~ # cat /etc/proflie cat: /etc/proflie: No such file or directory root@tester ~ # which cat /usr/bin/cat root@tester ~ # /usr/bin/cat /etc/proflie /usr/bin/cat: /etc/proflie: No such file or directory Also this root@tester ~ # ls /etc/bash* bash_logout bashrc root@tester ~ # cat /etc/bashrc cat: /etc/bashrc: No such file or directory root@tester ~ # ll /etc/bashrc ls: /etc/bashrc: No such file or directory root@tester ~ # ll /etc/bash* total 8.0K -rw-r--r-- 1 root root 132 May 2 15:59 bash_logout -rw-r--r-- 1 root root 1.7K May 2 15:59 bashrc root@tester ~ # less /etc/bashrc /etc/bashrc: No such file or directory This happening in multi-gnome terminal and in my consules. Whats strange to me is I start X with "startxfce4" and that worked but as above source /etc/profile and "set PS1="blah from profile" doesnt.
If I su as root or usr and give the root password im returened to the origianl usr with color prompt. I also re-emerged baselayout and bash with no change. :(
Ok to clarify my last comment when I su I do change to root. Before su PS1='\u@\h \w \$ ' after su PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'. After su if I exit back to user PS1 is set correctly. Its late and my brain is shuting down. Its /etc/bash/bashrc not /etc/bashrc which from /etc/profile if [ -n "${BASH_VERSION}" ]; then # Newer bash ebuilds include /etc/bashrc which will setup PS1 # including color. We leave out color here because not all # terminals support it. ====> if [ -f /etc/bashrc ]; then # Bash login shells run only /etc/profile and # Bash non-login shells run only /etc/bashrc below # Since we want to run /etc/bashrc always we source it # from here. It is unfortunate that there is no way to do # this *after* the user's .bash_profile runs (without putting # it in the user's dot-files), but it shouldn't make any # difference. ==========> . /etc/bashrc <========= else PS1='\u@\h \w \$ ' fi should be ". /etc/bash/bashrc"