您的位置:首页 > 职场人生

变量$REPLY是'read'命令结果保存的默认变量

2011-11-15 23:50 281 查看
#!/bin/bash

select item in one two three four five

do

if [ ! -z "$item" ];then

echo "Your chose option number $REPLY while is \"$item\""

else

echo "$REPLY is not valid."

fi

done


[root@bogon script]# ./select1.sh

1) one

2) two

3) three

4) four

5) five

#? 1

Your chose option number 1 while is "one"

#? 3

Your chose option number 3 while is "three"

#? 4

Your chose option number 4 while is "four"

#? 7

7 is not valid.

#?

[root@bogon script]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 休闲 number