Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[gelöst] bash farben
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
misterxx
Guru
Guru


Joined: 18 Apr 2004
Posts: 509

PostPosted: Wed Sep 01, 2004 2:05 pm    Post subject: [gelöst] bash farben Reply with quote

Hallo,

habe ein kleines Problem, dass ich gerne lösen möchte:

es geht um die Farben in der bash-konsolle. Wenn ich als normaler User bash benutze, habe ich eine für meinen Hintergrund passende Textfarbe. Sobald ich aber zu root wechsele verändert sich die Textfarbe au eine andere (blau). Auch wenn ich zurück zu User wechsele bleibt diese falsche Farbe als aktuelle Textfarbe.


bash-2.05b$ cd /
bash-2.05b$ su
Password:

root@acer / $ exit
exit
bash-2.05b$


Von da die Frage, wieso kommt sowas vor und wo kann ich es regeln. Danke im Voraus.


Last edited by misterxx on Wed Dec 01, 2004 1:23 pm; edited 2 times in total
Back to top
View user's profile Send private message
XMath
Guru
Guru


Joined: 14 Aug 2004
Posts: 435
Location: Germany, Gaimersheim

PostPosted: Wed Sep 01, 2004 2:46 pm    Post subject: Reply with quote

Hi,
das ganze kannst du mittels einer per-user .bash-rc Datei in dem jeweiligen Heimverzeichnis einstellen.

Mittels Google findest du auch einige Beispiele und Anleitungen.

MfG
Back to top
View user's profile Send private message
_hephaistos_
Advocate
Advocate


Joined: 07 Apr 2004
Posts: 2694
Location: salzburg, austria

PostPosted: Wed Sep 01, 2004 2:49 pm    Post subject: Reply with quote

hallo,

die standardeinstellungen sind in /etc/profile
XMath wrote:
das ganze kannst du mittels einer per-user .bash-rc Datei in dem jeweiligen Heimverzeichnis einstellen.

ja, in ~/.bashrc kann der user seinen eigenen prompt etc setzen...

hth,
ciao
Back to top
View user's profile Send private message
Xk2c
Apprentice
Apprentice


Joined: 17 Jul 2004
Posts: 240

PostPosted: Wed Sep 01, 2004 4:48 pm    Post subject: Reply with quote

hallo misterxx

wie bereits erwähnt wurde werden die Einstellungen in global in /etc/profile und local ( für jeden user ) in ~/.bashrc vorgenommen.

mir ist da nämlich etwas aufgefallen. Du machst
Code:
su
und nicht
Code:
su -


der Unterschied ist, das bei
Code:
su -
die Konfigurationsdateien des Users ( root ) gelesen werden.
siehe Beispiel von mir:

larry@Gentoo $ su
root@Gentoo #exit
larry@Gentoo $ su -
Gentoo root #

wenn du das hier in deine /etc/profile einfügst und dann das PS1 jeweils noch anpasst sollte das funktionieren:
Code:
if [ `/usr/bin/whoami` = 'root' ]
then
        # Do not set PS1 for dumb terminals
        if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
        then
                export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
        fi
        export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
else
        # Do not set PS1 for dumb terminals
        if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
        then
                export PS1='\[\033[01;32m\]\u\[\033[30m\]@\[\033[01;32m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
        fi
        export PATH="/bin:/usr/bin:${PATH}"
fi
unset ROOTPATH


die Zeile PS1 wird nur hier im Forum umgebrochen, in deiner config muss das ein einzeiler sein.
_________________
useful Xterm, Aterm and RXVT-Unicode features
Back to top
View user's profile Send private message
_hephaistos_
Advocate
Advocate


Joined: 07 Apr 2004
Posts: 2694
Location: salzburg, austria

PostPosted: Wed Sep 01, 2004 4:50 pm    Post subject: Reply with quote

bei mir funktionierts auch ohne "su -" dh: NUR "su".
ich source halt in der jeweiligen .bashrc die /etc/profile ein...[/quote]
Back to top
View user's profile Send private message
Xk2c
Apprentice
Apprentice


Joined: 17 Jul 2004
Posts: 240

PostPosted: Wed Sep 01, 2004 4:55 pm    Post subject: Reply with quote

cooler tip danke
/me noch gar net dran gedacht hat
_________________
useful Xterm, Aterm and RXVT-Unicode features
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