[lfs-support] PS1 for user lfs

Philippe Delavalade philippe.delavalade at orange.fr
Mon Apr 23 05:26:49 PDT 2012


Le samedi 21 avril à 18:48, Bruce Dubbs a écrit :
> Andrew Benton wrote:
> > On Fri, 20 Apr 2012 21:38:37 +0100
> > Philippe Delavalade <philippe.delavalade at orange.fr> wrote:
> > 
> >> Hi.
> >>
> >> I'm building svn-9812 ; my host is debian/wheezy ; I encounter for the
> >> first time a little problem in 4.4.
> >>
> >> When becoming user lfs and after having passed the command
> >>
> >> source .bash_profile
> >>
> >> I don't obtain the right prompt ; all variables are correct except PS1
> >> which is
> >>
> >> PS1=${debian_chroot:+($debian_chroot)}\u@\h:\w\$
> >>
> >> Maybe it's not important (and I think so) but nevertheless, I fear that
> >> this uncorrect value can hide other problems...
> > 
> > I've noticed the same issue when using Ubunut as a host, when I su to
> > the user lfs I didn't get the bare bash prompt. Like you I worried that
> > it might hide other environment variables that were being preserved
> > from the host. Unlike you I've never taken the time to investigate it,
> > I just cracked on and it all turned out fine so I didn't look back. I
> > suspect that they compile a default PS1 into bash but it's just a
> > suspicion.
> 
> On Debian based systems, PS1 is set to use debian_chroot in /etc/bash.bashrc. 
> When we run
> 
> exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
> 
> bash is rerun as an interactive shell and executes both /etc/bash.bashrc and 
> ~/.bashrc.
> 
> I'm not sure we need to worry about this, but I can't quite figure out how to 
> only run ~/.bashrc.

Hi.

First, I have completed chapter 6 and nothing special arrives ; so, it seems
to me that just the PS1 variable was affected.

Secondly, In /etc/bash.bashrc (on my debian/wheezy host), I have commented
the folloing lines :

if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

and I inseted this one :

PS1='\u:\w\$ '

Then, I created a new group and a new user with the commands in teh book and
I obtained the wanted prompt.

Many thanks for your help.

-- 
Ph. Delavalade



More information about the lfs-support mailing list