标签:shell
#!/bin/bash
file="/export/ucinfo/shell/memory.log"
mem=`grep "used_memory:" $file | cut -d: -f2`
maxmem=`grep "maxmemory:" $file | cut -d: -f2`
number=`awk -v mem=$mem -v maxmem=$maxmem ‘BEGIN{printf "%0.2f\n",mem/maxmem}‘`
number01=`echo $number |awk -F "." ‘{print $2}‘`
echo $number01
number02=75
if [ "$number01" -lt "$number02" ]
then
echo "less than 0.75"
else
echo "more than 0.75"
fi
本文出自 “付炜超” 博客,谢绝转载!
标签:shell
原文地址:http://9399369.blog.51cto.com/9389369/1883588