littlebat wrote: > Hi, > > I am learning: 4.4. Setting Up the Environment: > http://www.linuxfromscratch.org/lfs/view/6.6/chapter04/settingenvironment.html > . My host system is Ubuntu 10.04. > > I found it can't properly to set $PS1 for user "lfs" with the command > below provided by LFS6.6 book under Ubuntu 10.04 host system.
cat > ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF > The reason is Ubuntu will setup PS1 in /etc/bash.bashrc, so I think > maybe we should set this value in ~/.bashrc ? No, that's not how it works. Upon login as the lfs user, bash executes /etc/profile $HOME/.bash_profile in that order. The 'exec env -i' portion ignores the environment that was set by /etc/profile. The second part sets up 3 and only 3 environment variables. bash itself sets up a few more, but not PS1. $HOME/.bashrc is not run by default in an initial login. Make sure you are doing an initial login. su - lfs The dash is important. Without it, $HOME/.bash_profile is not run and only $HOME/.bashrc is run. Other sub-shells that are run by the lfs user do use $HOME/.bashrc Take a look at the invocation portion of the bash man page and also at the env man page. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
