赞
踩
根据选项显示磁盘或内存,swap的使用情况
#!/bin/bash # cat << EOF d|D) show disk usage m|M) show memory usage s|S) show swap usage *) quit EOF echo -e '\033[31mPlease input your choice:\033[0m' read selectOption while [ $selectOption != 'quit' ]; do case $selectOption in d|D) echo "Disk usage:" df -Ph ;; m|M) echo "memory usage:" free -m | grep Mem ;; s|S) echo "swap usage:" free -m | grep Swap ;; *) echo "Unknown" esac echo -e '\033[31mPlease input your choice again:\033[0m' read selectOption done
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。