From 1389f0027d09785017e993f4dc61c6b25c2cca1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 21 Feb 2016 19:57:15 +0800 Subject: [PATCH] uuid fix --- bash/bashrc/rbashrc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc index 4341391..118b092 100644 --- a/bash/bashrc/rbashrc +++ b/bash/bashrc/rbashrc @@ -111,17 +111,21 @@ function __cacheDownload { } function __uuid { - which -s uuidgen + local __out=$1 + + which uuidgen 2&>1 > /dev/null if [ $? -eq 0 ]; then - uuidgen + local uuid=$( uuidgen ) else - cat /proc/sys/kernel/random/uuid + local uuid=$( cat /proc/sys/kernel/random/uuid ) fi + eval $__out="'$uuid'" } function rbash_upgrade { echo "Updating the .bashrc" - TMPFILE=/tmp/$( __uuid ) + __uuid TEMP_UUID + TMPFILE=/tmp/$TEMP_UUID curl -s "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/rbashrc;hb=HEAD" > $TMPFILE if [ -z "$1" ]; then @@ -132,8 +136,8 @@ function rbash_upgrade { MCC_NAME=$2 fi - UUID=$( __uuid ) - PASS=$( __uuid ) + __uuid UUID + __uuid PASS PMC_NAME=$( echo "#_MACHINE_NAME_#" | sed -e "s/#_//g" ) PMCC_NAME=$( echo "#_MACHINE_COLORED_NAME_#" | sed -e "s/#_//g" ) UUID_TOK=$( echo "#_UUID_#" | sed -e "s/#_//g" )