代码如下:
#!/bin/bash
while true
do
read -n1 key
if [[ "$key" = b || "$key" = B || "$key" = e || "$key" = E || "$key" = "" ]]
then
echo "Key : $key " >>/home/nibj/free.txt
date >>/home/nibj/free.txt
# free -m | awk '{print $3}' >>/home/nibj/free.txt
free -m >> /home/nibj/free.txt
else
echo "" >> /home/nibj/free.txt
continue
fi
done
==========================================================================
另一个:
#!/bin/bash
while true
do
read -n1 key
if [ "$key" != hxx ]
then
echo "Key : $key " >>/home/nibj/free.txt
date >>/home/nibj/free.txt
free -m >> /home/nibj/free.txt
fi
echo "" >> /home/nibj/free.txt
done
==========================================================================
两个代码,好象都不是我理想中想要的.
阅读(980) | 评论(0) | 转发(0) |