linux下定义颜色提示符

#!/bin/bash
# This should go in your ~/.bashrc file

# Define ANSI color sequences
NORMAL="\[\033[0m\]"
WHITE="\[\033[0;37;40m\]"
MAGENTA="\[\033[0;35;40m\]"
BRIGHTBLUE="\[\033[1;34;40m\]"
BRIGHTWHITE="\[\033[1;37;40m\]"
BRIGHTMAGENTA="\[\033[1;35;40m\]"

# Find out if we are root
if [ $UID -eq 0 ] ; then
   # The # character serves as an extra reminder that I am root
   SYM='#'
else
   SYM='-'
fi

# Define the actual prompt
# This is split up for easier reading within this book
P1="$MAGENTA$SYM$BRIGHTMAGENTA-$BRIGHTBLUE($WHITE\u$MAGENTA@$WHITE"
P2="\h$BRIGHTBLUE)$BRIGHTMAGENTA-$BRIGHTBLUE($BRIGHTWHITE\w$BRIGHTBLUE"
P3=")$BRIGHTMAGENTA-$MAGENTA$SYM$NORMAL\n$MAGENTA$SYM$BRIGHTMAGENTA-"
P4="$BRIGHTBLUE($BRIGHTWHITE\$?$BRIGHTBLUE)$MAGENTA>$NORMAL "
PS1="$P1$P2$P3$P4"


你可能感兴趣的:(linux下定义颜色提示符)