shell脚本,循环的记录
1 ######################################################################### 2 # File Name: showlogged.sh 3 # Author: zhang yunabo 4 # mail: ma6174@163.com 5 # Created Time: Mon 27 Aug 2018 08:07:33 AM EDT 6 ######################################################################### 7 #!/bin/bash 8 declare -i debug=0 9 declare -i count=0 10 declare -i showusers=0 11 12 for i in `seq 1 $#`;do 13 if [ $# -gt 0 ];then 14 case $1 in 15 -h|--help) 16 echo "usage:`basename $0` -h|--help -c|--counts -v|--verbose" 17 exit 0;; 18 -v|--verbose) 19 let debug+=1;; 20 -c|--counts) 21 let count+=1;; 22 *) 23 echo "usage:`basename $0` -h|--help -c|--counts -v|--verbose" 24 exit 0;; 25 esac 26 fi 27 shift 28 done 29 30 if [ $count -eq 1 ] 31 then 32 echo "loged user :`who | wc -l`" 33 fi 34 if [ $debug -eq 1 ] 35 then 36 w 37 fi