linux shell编程之菜单选择(二)

转自:http://wolfchen.blog.51cto.com/2211749/964997

#!/bin/bash
cat <50)print "disk space is used over 50%";else print "disk space is user below 50%"}'
  ;;
  D)
	 netstat -nptl | awk '/LISTEN/{print $7}'|awk -F/ '{print $2"("$1")"}'
  ;;
  E)
	 ifconfig eth0 | awk -F"[ :]+" 'NR==2{print $4"/"$NF}'
  ;;
  F)
	echo -e "Please input username"
        read user
        echo -e "Please input password"
        read pass
        useradd $user
        echo $pass | passwd --stdin $user
  ;;
  G)
	awk '{++a[$1]}END{for(i in a)print i,a[i]|"sort -k2 -nr"} ~/.bash_history' | head
  ;;
  *)
    printf "your input is wrong\n"
;;
esac


你可能感兴趣的:(linux,shell编程)