select_Example.sh
#!/bin/bash
echo "what is your favorites color? pls input the number"
select color in "red" "blue" "green" "white" "black"
do
break
done
echo "you have selected $color"
Bash选择菜单示例
本文介绍了一个简单的Bash脚本示例,该脚本使用内置的select命令创建了一个交互式的颜色选择菜单。用户可以通过输入对应的数字来选择喜欢的颜色。
#!/bin/bash
echo "what is your favorites color? pls input the number"
select color in "red" "blue" "green" "white" "black"
do
break
done
echo "you have selected $color"
7366
7322

被折叠的 条评论
为什么被折叠?