脚本2 (监控)

#!/bin/sh
echo  -n "Please enter the number of person from the server  :"
read num
n=`tail -n1 shuchu`
  if [ $n -eq $num ] ;   then  
   echo $num >> shuchu
  else
    echo $num >shuchu
  fi
 m=`wc -l shuchu|awk '{print $1}'`
  if [ $m -ge 5 ] && [ $m -le 20 ] ;    then
        if [ $n -eq 0 ]
            then
        echo "---------------------------------------------"
               echo  -e "This group is 0 people and the $m times 0 \a  "
        fi
        if  [ $n -eq 500 ] ;               then
         echo "--------------------------------------------"
          echo -e  "This group is 500 people and the $m times 500 \a "
        fi
  fi
   if [ $m -ge 5 ] && [ $n -ne 0 ] && [ $n  -ne 500 ] ;   then
      echo "---------------------------------------------------"
      echo -e "This group is $n people and the $m times $n \a  "
   fi
   echo "The shell script run time : $SECONDS"


posted on 2011-11-06 13:00  无心出岫  阅读(228)  评论(0编辑  收藏  举报