random color code

This commit is contained in:
斟酌 鵬兄 2016-02-21 20:25:03 +08:00
parent 872980cb8a
commit 1cfe87fdc4

View File

@ -142,11 +142,15 @@ function rbash_upgrade {
PMCC_NAME=$( echo "#_MACHINE_COLORED_NAME_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
UUID_TOK=$( echo "#_UUID_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
PASS_TOK=$( echo "#_PASSWD_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
COLOR_CODE_TOK=$( echo "#_COLOR_CODE_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
COLOR_CODE=$(( $RANDOM * 6 / 32767 + 1 ))
sed -i \
-e "s/$PMC_NAME/$MC_NAME/g" \
-e "s/$PMCC_NAME/$MCC_NAME/g" \
-e "s/$UUID_TOK/$UUID/g" \
-e "s/$PASS_TOK/$PASS/g" \
-e "s/$COLOR_CODE_TOK/$COLOR_CODE/" \
$TMPFILE
mv $TMPFILE ~/.bashrc
@ -165,7 +169,7 @@ function rbash_run {
rm "$TMPFILE";
}
export PS1='This is <MACHINE_NAME>\e[1;31m<MACHINE_COLORED_NAME>\e[0m: \w\n$ '
export PS1='This is <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n$ '
export EDITOR=vim
# User specific aliases and functions