Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Frage zur bash PS1 Umgebungsvariable
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
mondauge
l33t
l33t


Joined: 08 Jan 2003
Posts: 603
Location: Schwetzingen, Germany

PostPosted: Tue Dec 21, 2004 3:02 pm    Post subject: Frage zur bash PS1 Umgebungsvariable Reply with quote

Hallo Leute,

ich hab mir folgende PS1 Variable zusammengebastelt, die auf meinem Gentoo System auch einwandfrei läuft.
Code:
PS1="\u@\h [\w] ->"

Wenn ich dieselbe PS1 Variable auf einer Nokia mit Ipso 3.8 verwende, auf der auch ne bash installiert ist, dann bekomme ich folgende Meldung:
Code:
bash: \033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007: bad substitution

Der prompt wird trotzdem korrekt angezeigt.

Jetzt bin ich leider etwas überfragt, was diese Meldung genau bedeutet und wie man das behebt?

mondauge
Back to top
View user's profile Send private message
mondauge
l33t
l33t


Joined: 08 Jan 2003
Posts: 603
Location: Schwetzingen, Germany

PostPosted: Tue Dec 21, 2004 3:13 pm    Post subject: Reply with quote

Ok.. selber richtig nachdenken macht schlau...

Das Problem ist, dass bei der bash unter IPSO die Umgebungsvariable $HOME nicht gesetzt wird. Der PS1 Schalter \w versucht aber, das Home-Verzeichnis mit einer Tilde zu ersetzen. Wenn aber $HOME nicht definiert ist, hat er Probleme beim ersetzen und gibt die substitute Meldung aus. Komischerweise hat die Substitution trotzdem funktioniert.

Naja.. das hat sich dann erledigt,
mondauge
Back to top
View user's profile Send private message
gentop
l33t
l33t


Joined: 29 Nov 2004
Posts: 639

PostPosted: Tue Dec 21, 2004 3:30 pm    Post subject: Reply with quote

Wo hier schon mal ein Thread über die PS1 steht - ich sehe die Logik dahinter nicht so ganz (Besonders in Sachen Farben). Wäre nett, wenn das mal jemand genauer erklähren könnte (oder mir nen Link zu nem "Howto" posten könnte).

Gruß gentop
Back to top
View user's profile Send private message
psyqil
Advocate
Advocate


Joined: 26 May 2003
Posts: 2767

PostPosted: Tue Dec 21, 2004 3:41 pm    Post subject: Reply with quote

Na klar: https://forums.gentoo.org/viewtopic.php?t=5850
Back to top
View user's profile Send private message
gentop
l33t
l33t


Joined: 29 Nov 2004
Posts: 639

PostPosted: Tue Dec 21, 2004 3:43 pm    Post subject: Reply with quote

*urgs* - na dann kram ich mal meine alten Englischkenntnisse wieder raus...
Back to top
View user's profile Send private message
DarKRaveR
Guru
Guru


Joined: 11 Oct 2003
Posts: 500
Location: Old Europe/G-Many

PostPosted: Wed Dec 22, 2004 4:08 am    Post subject: Reply with quote

Ich weiß nicht genau, was Du in Punkto Logik und Farbe meinst, aber:

Die Farbe setzt Du mti Ansi ESC-Sequenzen, das ist alles, üblicherweise macht man so spielerein, wie eine Farbe für root, andere für unprivilegiert, zusätzlich auch noch ein zeichen, welches das ganez signalisiert, falls man mal mit nem guten alten vt220 am serial port hängt :lol: .
Back to top
View user's profile Send private message
gentop
l33t
l33t


Joined: 29 Nov 2004
Posts: 639

PostPosted: Wed Dec 22, 2004 8:51 am    Post subject: Reply with quote

Dann erklähr mir doch mal bitte die Syntax der Farbsequenzen. Das wäre hilfreich für mich.

Gruß gentop
Back to top
View user's profile Send private message
DarKRaveR
Guru
Guru


Joined: 11 Oct 2003
Posts: 500
Location: Old Europe/G-Many

PostPosted: Wed Dec 22, 2004 9:44 am    Post subject: Reply with quote

http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html

http://thinkunix.net/unix/tips/bash-color.html

Es ist letztendlich ganz einfach:
ESC[FARBEm

ESC erzeugst Du indem Du mit \ den character erzeugst, ESC ist oktal 033, also:

\033[FARBEm

FARBE mußt Du in der Tabelle nachschauen, dazu gibts noch attribute wie bold(fett) usw.
Back to top
View user's profile Send private message
gentop
l33t
l33t


Joined: 29 Nov 2004
Posts: 639

PostPosted: Wed Dec 22, 2004 9:47 am    Post subject: Reply with quote

Alles klar. Vielen Dank erstmal ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum