shell脚本中变量的递归使用--真实内存使用查看脚本
脚本中进行变量计算时,需要加一个[ ],在外面再套一个$ [root@ES25 tmp]# cat real_mem_used01.sh 方法二: [root@ES25 tmp]# cat aa.sh #!/bin/bashReal_used=`free -g|grep cache |grep ":"|awk '{print $3}'`Total=`free -g|grep Mem|awk '{print $2}'`awk 'BEGIN{printf"%.2fn",('$Real_used'/'$Total')*100}'[root@ES25 tmp]# sh aa.sh 10.64[root@ES25 tmp]# (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |