用处一:在read语句中:
[[email protected] shell]# read #在不使用参数的时候,read从标准输入读取的值,将会存储$REPLY内部变量中 mah [[email protected] shell]# echo $REPLY mah [[email protected] shell]# read var MAH [[email protected] shell]# echo $var MAH
用处二:在select语句中:
#!/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 [[email protected] shell]# ./select1.sh Pls choose your professional: 1) worker 2) doctor 3) teacher #? 1 the $REPLY is 1 your professional is worker
内部变量REPLY
时间: 2024-11-14 12:49:52