penguin/utils

my env utils

commit 1cfe87fdc49426c691373b3700a4dbc5d9e8e5f0

author斟酌 鵬兄 <tgckpg@gmail.com>
date2016-02-21T12:25:03Z
subjectrandom color code
commit 1cfe87fdc49426c691373b3700a4dbc5d9e8e5f0
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2016-02-21T12:25:03Z

    random color code
---
 bash/bashrc/rbashrc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc
index 6821d13..5b8b3ec 100644
--- a/bash/bashrc/rbashrc
+++ b/bash/bashrc/rbashrc
@@ -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