read 变量名
read -p " 提示信息 :" 变量名
[root@server ~] # read -p "Enter Numbers: " numEnter Numbers: 9527[root@server ~] # echo $num9527[root@server ~] # read -t 3 n1 # 不要输入内容,等待 3 秒后自动结束输入[root@server ~] # read -s -p "Enter your password: " passwEnter your password:
[root@server ~]# echo $passw
123456[root@server ~] # echo $REPLY[root@server ~] # read100[root@server ~] # echo $REPLY # 当输入时没有指定变量接收,会默认存储到 REPLY 变量中100# 一次性输入多个变量的值[root@server ~] # read t1 t212 35[root@server ~] # echo $t1 $t212 35