您的位置:首页 > 运维架构 > Shell

shell-menu

2018-02-21 11:26 423 查看
#!/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