I have this bash code, when I run this, it throws arithmetic operator error
#!/bin/bash
path=$1;
cluster=`cd $1; df -k . | tail -1 | awk -F: '{print $1}' | awk -F- '{print $1}'`
volume=`cd $1; df -k . | tail -1 | awk '{print $1}' | awk -F: '{print $2}' | awk -F/ '{print $3}'`
if [[ $cluster == *"clap"* ]]; then
avg_latency_val=$(cd /net/kkcmon02/app/whisper/netapp/perf/sanjose/$cluster-cls-mgt/svm/vs0/vol/$volume; whisper-fetch --pretty avg_latency.wsp| tail -n 30 | grep -v None | awk -v N=6 '{ sum += $N } END { if ( NR > 0 ) {print sum/NR} else {print 0}}')
elif [[ $cluster == *"isic"* ]]; then
echo "Graphana can monitor only Netapp volumes & this is a volume coming from Isilon."
else
avg_latency_val=$(cd /net/kkcmon02/app/whisper/netapp/perf7/sanjose/$cluster/vol/$volume; whisper-fetch --pretty avg_latency.wsp| tail -n 30 | grep -v None | awk -v N=6 '{ sum += $N } END { if ( NR > 0 ) {print sum/NR} else {print 0}}')
fi
if [[ "${avg_latency_val}" -le "30" ]] ; then
echo "Average Latency on the volume for last 30 mins is "${avg_latency_val}" ms (Good)"
elif [[ "${avg_latency_val}" -gt "30" ]] ; then
echo "Average Latency on the volume for last 30 mins is "${avg_latency_val}" ms (Bad)"
else
echo "Average Latency on the volume Looks Good!!"
fi
Below is the error occurred when I ran the above code. Please let me know what I'm doing wrong here
k_test.sh: line 21: [[: 1.98381: syntax error: invalid arithmetic operator (error token is ".98381")
bccommand((..))instead of[[..]]