From 73844833cebb00d08108ad6dbea36e208c33cbb1 Mon Sep 17 00:00:00 2001 From: Mason Rowe Date: Fri, 10 Jan 2020 15:48:58 -0500 Subject: [PATCH] Fix locale override --- yabs.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/yabs.sh b/yabs.sh index 9079c47..dfa0cc2 100755 --- a/yabs.sh +++ b/yabs.sh @@ -22,6 +22,9 @@ echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e date +# override locale to eliminate parsing errors (i.e. using commas a delimiters rather than periods) +export LC_ALL=C + # gather basic system information (inc. CPU, AES-NI/virt status, RAM + swap + disk size) echo -e echo -e "Basic System Information:" @@ -89,14 +92,14 @@ function disk_test { while [ $I -lt 3 ] do # write test using dd, "direct" flag is used to test direct I/O for data being stored to disk - DISK_WRITE_TEST=$(LC_ALL=C dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}') + DISK_WRITE_TEST=$(dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}') VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1) [[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }') DISK_WRITE_TEST_RES+=( "$DISK_WRITE_TEST" ) DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }') # read test using dd using the 1G file written during the write test - DISK_READ_TEST=$(LC_ALL=C dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}') + DISK_READ_TEST=$(dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}') VAL=$(echo $DISK_READ_TEST | cut -d " " -f 1) [[ "$DISK_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }') DISK_READ_TEST_RES+=( "$DISK_READ_TEST" ) @@ -345,3 +348,6 @@ fi # finished all tests, clean up all YABS files and exit echo -e rm -rf $YABS_PATH + +# reset locale settings +unset LC_ALL