[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Quick question

On Wednesday 03 January 2007 09:00, Gregor Schneider wrote:
> Hi guys,
> just a short question:
> After installing Edge, I see the common-user-$PS1 as follows:
> ${debian_chroot:+($debian_chroot)}\u@\h:\w\$
> I understand \u@\h:\w\$, however, what does
> ${debian_chroot:+($debian_chroot)}
> do?

From the bash manpage under the "Parameter Expansion" section:

      Use  Alternate  Value.   If parameter is null or
      unset, nothing is substituted, otherwise the
      expansion of word is substituted.

Basically, this is to show info about the current chroot you are in. This is 
useful for when you have various chroots (say for different debian 
versions, etc).

The value gets pulled from the environment, or from /etc/debian_chroot. See 
this part of /etc/bash.bashrc:
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)

Wesley J. Landaker <wjl@icecavern.net> <xmpp:wjl@icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

Attachment: pgpkZmslX09gl.pgp
Description: PGP signature

Reply to: