Bananas Development Blog: share your thoughts

Color Bash Prompt

Ich habe ja mal was geschrieben über die Veränderung der Bash Prompt.

http://blog.bananas-playground.net/index.php?/archives/78-Bash-color.html

Gerade eben habe ich auch meine bash prompt bei Gentoo geändert.
Dafür habe ich folgenden post genommen.
bash prompt

Das beinhaltete Script habe ich wie folgt abgeändert, dass es auch auf hellen terminal Fenstern geht.
[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
function set_prompt {

        local BLACK="\[\033[0;30m\]"
        local BLUE="\[\033[0;34m\]"
        local GREEN="\[\033[0;32m\]"
        local CYAN="\[\033[0;36m\]"
        local RED="\[\033[0;31m\]"
        local PURPLE="\[\033[0;35m\]"
        local BROWN="\[\033[0;33m\]"
        local LIGHT_GRAY="\[\033[0;37m\]"
        local DARK_GRAY="\[\033[1;30m\]"
        local LIGHT_BLUE="\[\033[1;34m\]"
        local LIGHT_GREEN="\[\033[1;32m\]"
        local LIGHT_CYAN="\[\033[1;36m\]"
        local LIGHT_RED="\[\033[1;31m\]"
        local LIGHT_PURPLE="\[\033[1;35m\]"
        local YELLOW="\[\033[1;33m\]"
        local WHITE="\[\033[1;37m\]"
        local NO_COLOUR="\[\033[0m\]"

        if [ $UID -eq 0 ]; then
                local user="$LIGHT_GRAY[$LIGHT_RED\u$LIGHT_GRAY@$HOST_COLOUR\h$LIGHT_GRAY]"
        else
                local user="$LIGHT_GRAY[$LIGHT_GREEN\u$LIGHT_GRAY@$HOST_COLOUR\h$LIGHT_GRAY]"
        fi

PS1="${user}\
$LIGHT_GRAY($BLUE\w$LIGHT_GRAY) \\$ $NO_COLOUR"



}

export PROMPT_COMMAND=set_prompt


Damit ist die Lesbarkeit auf hellen Terminals erheblich besser ;-)

Banana out.

Ach ja vielen Dank für das Google Ranking auf Seite 1.
  • No comments

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Trackbacks / Pingbacks

  • No Trackbacks