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
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
相关文章推荐
- 【Electron】Electron开发入门(八):自定义electron框架外壳(shell)的菜单(Menu)
- shell 脚本菜单menu
- shell 脚本(menu)
- Function Menu use Shell
- shellext menu com
- 获取服务器信息shell脚本:内存大小,cpu型号,系统发行版本,硬盘个数及大小等
- Bash For Loop Examples for Your Linux Shell Scripting--ref
- shell文件权限问题
- 查找目录下同名但不同后缀名文件的shell脚本代码
- PieTTY工具下的linux的shell中的linux命令(第二讲)
- shell脚本学习5——字符串和注释
- shell中的各种括号的使用方法
- shell-init: error retrieving current directory: getcwd: cannot access parent directories
- shell
- Python execute adb shell command
- LINUX中,Shell 参数置换变量
- 简单的shell脚本备份数据库和代码
- shell 去除utf8文件中bom头的方法
- shell判断一个变量是否为空
- shell创建mysql表