码迷,mamicode.com
首页 > 系统相关 > 详细

shell-menu

时间:2018-02-21 11:43:59      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:dev   form   mem   input   scp   ase   isp   ==   while   

#!/bin/bash
cat <<EOF
cpu)display cpu information
mem)display mem information
disk)display disk information
quit)display quit information
EOF
while read -p "please input :" value
do
while [ $value != "cpu" -a $value != "mem" -a $value != "disk" -a $value != "quit" ]
do
read -p "please input ‘cpu|mem|disk|quit‘ :" value
done
if [ "$value" == "cpu" ]
then
lscpu
elif [ "$value" == "mem" ]
then
free -m
elif [ "$value" == "disk" ]
then
fdisk -l /dev/[hs]d[a-z]
elif [ "$value" == "quit" ]
then
exit 0
fi
done

shell-menu

标签:dev   form   mem   input   scp   ase   isp   ==   while   

原文地址:http://blog.51cto.com/11972980/2071998

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!