From 96b9dc9b32178f99d9b7a747232289b22f5af6d4 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 12 May 2019 19:13:06 +0800 Subject: [PATCH] Remoe unnecessary `$` on arithmetic variables in shell script --- unbound.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unbound.sh b/unbound.sh index 9467183..c793094 100755 --- a/unbound.sh +++ b/unbound.sh @@ -5,16 +5,16 @@ ZONES_DIR="/opt/unbound/etc/unbound/zones" reserved=12582912 availableMemory=$((1024 * $( (fgrep MemAvailable /proc/meminfo || fgrep MemTotal /proc/meminfo) | sed 's/[^0-9]//g' ) )) -if [ $availableMemory -le $(($reserved * 2)) ]; then +if [ $availableMemory -le $((reserved * 2)) ]; then echo "Not enough memory" >&2 exit 1 fi -availableMemory=$(($availableMemory - $reserved)) -msg_cache_size=$(($availableMemory / 3)) -rr_cache_size=$(($availableMemory / 3)) +availableMemory=$((availableMemory - reserved)) +msg_cache_size=$((availableMemory / 3)) +rr_cache_size=$((availableMemory / 3)) nproc=$(nproc) if [ "$nproc" -gt 1 ]; then - threads=$(($nproc - 1)) + threads=$((nproc - 1)) else threads=1 fi