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

shell的select脚本的简单入门

时间:2018-10-10 14:13:53      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:select   sel   nbsp   div   bash   color   hat   rap   you   

shell的select脚本的简单入门


 

语法:
select var in ...;do
break;
done
echo $var

 

示例:

#/bin/bash
echo "what is your favourite fruit?"
select fruit in "Apple" "Banana" "Orange" "Grape" "Other";
do break; done echo "you have selected $fruit"

结果:

what is your favourite fruit?
1) Apple
2) Banana
3) Orange
4) Grape
5) Other
#? 2
you have selected Banana

 


 

shell的select脚本的简单入门

标签:select   sel   nbsp   div   bash   color   hat   rap   you   

原文地址:https://www.cnblogs.com/gyfluck/p/9765495.html

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