On 2019-11-26 12:54 -0600, Bruce Dubbs wrote: > On 11/26/19 9:30 AM, Xi Ruoyao wrote: > > > But on Arch (and some other distributions) non-login bash loads > > /etc/bash.bashrc before .bashrc. The environments in bash.bashrc > > may > > pollute the LFS building environment. For example, on Arch, our > > $PS1 > > (set in .bash_profile, should be '\u:\w\$ ') would be overwritten > > (become `[\u@\h \W]\$ '). > > With the exception of PS1, is there anything else in > /etc/bash.bashrc > that interferes with the lfs user's environment? We could easily > fix > the PS1 issue by adding > > PS1='\u:\w\$ ' > > to our .bashrc.
On Arch Linux it also sets $PROMPT_COMMAND, and then sources /usr/share/bash_completion/bash_completion (!). > We could also add a note for the user to check the contents of > /etc/bash.bashrc and, if needed, move it out of the way. > > Also, I wonder if using > > exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash --rcfile > ~/.bashrc > > would disable sourcing /etc/bash.bashrc. No. I tried that. I found a solution with Google: /home/lfs/.bash_profile: exec env -i ENV=$HOME/.bashrc \ HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash --posix /home/lfs/.bashrc: set +o posix set +h umask 022 # .... (same as LFS book) "--posix" will start POSIX mode and disable rc file loading. Then we use "ENV=$HOME/.bashrc" to tell bash to load our .bashrc file. At last use "set +o posix" in .bashrc to exit POSIX mode. -- Xi Ruoyao <xry...@mengyan1223.wang> School of Aerospace Science and Technology, Xidian University -- http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page Do not top post on this list. A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? http://en.wikipedia.org/wiki/Posting_style