用处一:在read语句中:
[root@server100 shell]# read #在不使用参数的时候,read从标准输入读取的值,将会存储$REPLY内部变量中
mah
[root@server100 shell]# echo $REPLY
mah
[root@server100 shell]# read var
MAH
[root@server100 shell]# echo $var
MAH
#!/bin/bash
echo "Pls choose your professional:"
select var in "worker" "doctor" "teacher"
do
echo "the \$REPLY is $REPLY"
echo "your professional is $var"
break
done
[root@server100 shell]# ./select1.sh
Pls choose your professional:
1) worker
2) doctor
3) teacher
#? 1
the $REPLY is 1
your professional is worker