Re: chroot bash prompt - was ist die Idee dabei?
Hi,
> Hallo zusammen,
> in sarge findet sich seit kurzem folgende Zeile:
> ,----[ /etc/bash.bashrc
> | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
> `----
> Nach einem
> ,----
> | # export debian_chroot="unstable"
> `----
> Hat man dann auch ungefähr so einen Prompt:
> ,----
> | (unstable)user@host:~$
> `----
> Ich frag mich nun was das soll. Wenn ich selber Variablen setzten muss
> kann ich auch gleich selbst den Prompt ändern. Gibt es vielleicht irgendeinen
> Mechanismus der die Variable automatisch setzten sollte, der aber bei
> mir (noch) nicht funktioniert?
> Nach lägerem Suchen habe ich z.B. das gefunden:
> ,----[ http://lists.debian.org/debian-devel-changes/2004/05/msg00560.html
> | * Update skeleton files and /etc/bash.bashrc to include the contents
> | of /etc/debian_chroot in the prompt, if the file exists.
> `----
> Die Datei habe ich jetzt mal selbst angelegt, aber erwartungsgemäß hat
> das natürlich keine Konsequenzen. Also wenn jemand eine Idee hat wie
> das gedacht ist / war ...
Die Skeleton Files (hier /etc/skel/.bash_profile) werden von bash
nicht direkt evaluiert. Nur beim Anlegen neue Users werden sie nach
$HOME des Users drüberkopiert.
Per default ist aber die Änderung oben kommentiert:
| $ pwd; grep -A5 commented .bash_profile
| /etc/skel
| # the rest of this file is commented out.
|
| # set variable identifying the chroot you work in
| #if [ -f /etc/debian_chroot ]; then
| # debian_chroot=$(cat /etc/debian_chroot)
| #fi
> Wenn man sich übrigens selbst eine Lösung basteln will könnte man z.B. mit
> sowas anfangen:
> ,----
> | PS1='$(if [ -f /etc/debian_chroot ]; then echo "("`cat /etc/debian_chroot`") "; fi;)\u@\h:\w\$ '
> `----
Gruss,
--
--Jhair
PGP key available from public servers - ID: 0xBAA600D0
Reply to: