Shell的select语句
$ cat test1.sh#!/bin/bash
echo "你的是什么操作系统?"
select os in "Linux" "Unix" "Mac" "Windows"
do
break
done
echo "你的操作系统是$os"
$ ./test1.sh #?后面的数字需要用户手动输入
你的是什么操作系统?
1) Linux
2) Unix
3) Mac
4) Windows
#? 1
你的操作系统是Linux
$ ./test1.sh
你的是什么操作系统?
1) Linux
2) Unix
3) Mac
4) Windows
#? 2
你的操作系统是Unix
页:
[1]