total=0
declare -a sum[10]
limit=`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g' | wc -l`
echo "Limit is equal to $limit"
ara="`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g'`"
for (( i=1; i<=$limit; i++ ))
do
sum[$i]=`echo $ara | cut -d " " -f $i`
echo ${sum[$i]}
if [ $total -eq 0 ]
then
total=${sum[$i]}
else
total=`echo $total + echo ${sum[$i]} | bc`
fi
done
echo "Total Hard Disk Size is $total"
When i try to run this script it is shooting an error called
Limit is equal to 4
18.11
0.00
./totalhardisk.sh: line 11: [: 18.11: integer expression expected
syntax error on line 1, teletype
18.11
./totalhardisk.sh: line 11: [: -eq: unary operator expected
syntax error on line 1, teletype
73.40
./totalhardisk.sh: line 11: [: -eq: unary operator expected
syntax error on line 1, teletype
Total Hard Disk Size is