公司做网站的费用用途写什么,怎样做网络推广效果好,网站兼容ie代码,商务类网站select结构是建立菜单的另一种工具#xff0c;该结构是从ksh中引入的
1.select格式
select variable [ in list ]
do commands
done
如果忽略了in list列表#xff0c;那么select命令将会使用传递到脚本的命令行参数($)#xff0c;或者是函数参数(当select是在函数中时…select结构是建立菜单的另一种工具该结构是从ksh中引入的
1.select格式
select variable [ in list ]
do commands
done
如果忽略了in list列表那么select命令将会使用传递到脚本的命令行参数($)或者是函数参数(当select是在函数中时)
2.样例
样例-1
[rootkibana ~]# cat select-1.sh
#!/bin/bashPS3Choose your favorite vegetable:
#设置提示符字符串
echoselect vegetable in beans carrots potatoes onions rutabagas
doechoecho Your favorite vegetable is $vegetable.break
doneexit 0
[rootkibana ~]# sh select-1.sh 1) beans
2) carrots
3) potatoes
4) onions
5) rutabagas
Choose your favorite vegetable: 1Your favorite vegetable is beans.
[rootkibana ~]# 样例-2
[rootkibana ~]# cat select-2.sh
#!/bin/bashPS3Choose your favorite vegetable:
#设置提示符字符串
echofunction choice_of_vegetable ()
{select vegetable#[in list]被忽略select会使用传递给函数的参数.doechoecho Your favorite vegetable is $vegetable.breakdone
}choice_of_vegetable beans carrots potatoes onions rutabagas# $1 $2 $3 $4 $5#传递给choice_of_vegetable()的函数
exit 0
[rootkibana ~]# sh select-2.sh 1) beans
2) carrots
3) potatoes
4) onions
5) rutabagas
Choose your favorite vegetable: 1Your favorite vegetable is beans.
[rootkibana ~]#