Commit d3f13582 authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

added the check for integers

parent 20600003
......@@ -15,6 +15,16 @@ debug() {
fi
}
INTS="sockets cores_per_socket threads_per_core main_mem"
must_be_int() {
for m in $INTS; do
if [[ "$1" == "$m" ]]; then
return 0
fi
done
return 1
}
ICPU=`lscpu`
IMEM=`cat /proc/meminfo`
......@@ -49,10 +59,14 @@ for m in ${!metrics[@]}; do
mval="${metrics[$m]}"
re='^[0-9]+$'
if ! [[ $mval =~ $re ]] ; then
out="$out$m=\"$mval\""
if must_be_int "$m"; then
if [[ $mval =~ $re ]] ; then
out="$out$m=$mval"
else
exit 3
fi
else
out="$out$m=$mval"
out="$out$m=\"$mval\""
fi
done
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment