根据用户的输入,显示系统的内存,硬盘及交换空间的使用情况

#!/bin/bash
#
function menu(){
cat << EOF
d|D) show disk usages
m|M) show memory usages
s|S) show swap usages
q|Q) quit.
EOF
}
while :;do
menu
read -p "Your choice: " choice
case $choice in
d|D)
df -lh
;;
m|M)
free -m | grep "^Mem"
;;
s|S)
free -m | grep "Swap"
;;
q|Q)
break
;;
*)
echo -e "\033[32mChoose the wrong re-selection\033[0m"
continue
;;
esac
done

posted @ 2017-05-11 14:54  孤鸟的悲歌丶  阅读(199)  评论(0编辑  收藏  举报