首页 > 代码库 > shell脚本

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脚本