Benutzer-Werkzeuge

Webseiten-Werkzeuge


 [[anwenderwiki:scripting:bash-prompt]] 

Darstellung des bash-promt anpassen

In der Datei /etc/bash.bashrc kann man Farben und Texte des bash-prompts einstellen.

Standard-Einstellung ist z.B. ROT für root:

PS1='${debian_chroot:+($debian_chroot)}\A/$? \[\033[01;31m\]\h \[\033[01;34m\]\w \$ \[\033[00m\]'

Umstellen auf Gelb mit einem Zusatztext „xyz-123“:

PS1='${debian_chroot:+($debian_chroot)}\A/$? \[\033[01;33m\]\h (xyz-123) \[\033[01;34m\]\w \$ \[\033[00m\]'

Komplette Farbliste:

# Foreground Color Array
FG_NAME[1]="Black "
FG_NAME[2]="Red "
FG_NAME[3]="Green "
FG_NAME[4]="Brown "
FG_NAME[5]="Blue "
FG_NAME[6]="Purple "
FG_NAME[7]="Cyan "
FG_NAME[8]="Light Grey "
FG_NAME[9]="Dark Grey "
FG_NAME[10]="Light Red "
FG_NAME[11]="Light Green "
FG_NAME[12]="Yellow "
FG_NAME[13]="Light Blue "
FG_NAME[14]="Light Purple "
FG_NAME[15]="Light Cyan "
FG_NAME[16]="White "

FG_NUMBER[1]="[0;30m"
FG_NUMBER[2]="[0;31m"
FG_NUMBER[3]="[0;32m"
FG_NUMBER[4]="[0;33m"
FG_NUMBER[5]="[0;34m"
FG_NUMBER[6]="[0;35m"
FG_NUMBER[7]="[0;36m"
FG_NUMBER[8]="[0;37m"
FG_NUMBER[9]="[1;30m"
FG_NUMBER[10]="[1;31m"
FG_NUMBER[11]="[1;32m"
FG_NUMBER[12]="[1;33m"
FG_NUMBER[13]="[1;34m"
FG_NUMBER[14]="[1;35m"
FG_NUMBER[15]="[1;36m"
FG_NUMBER[16]="[1;37m"

# Background Color Array
BG_NAME[1]="Black "
BG_NAME[2]="Red "
BG_NAME[3]="Green "
BG_NAME[4]="Brown "
BG_NAME[5]="Blue "
BG_NAME[6]="Purple"
BG_NAME[7]="Cyan "
BG_NAME[8]="Grey "

BG_NUMBER[1]="[40m"
BG_NUMBER[2]="[41m"
BG_NUMBER[3]="[42m"
BG_NUMBER[4]="[43m"
BG_NUMBER[5]="[44m"
BG_NUMBER[6]="[45m"
BG_NUMBER[7]="[46m"
BG_NUMBER[8]="[47m"
 [[anwenderwiki:scripting:bash-prompt]] anwenderwiki/scripting/bash-prompt.txt · Zuletzt geändert: 2012/12/23 23:03 (Externe Bearbeitung)