#! /bin/bash
#Shell中read的选项及用法 https://blog.csdn.net/guominyou/article/details/80923734
:<<!
-a 将终端内容读入到指定数值中
-d 读入到指定字母后再停止
-n 用于限定最多可以有多少字符可以作为有效读入
-p 输入提示文字
-s 隐藏输入内容
-t 输入限时
!
read -a array
echo "-a " $array "length = $(expr length $array)"
read -p "输入内容以e结束: "-d e out #输入字符传以e结尾,中间空格,回车不代表输入结束
echo -e "\n-d $out"
read -n 4 out #仅能输入4个字符就结束
echo -e "\n-n $out"
read -p "Input passwd:" -s Passwd
echo -e"\n 其实是 $Passwd"
read -p "-t Input a number:" -t 5 Number #延迟五秒,没有输入将自动退出
read -dp -p "Input some words end with q:" word #输入,直到输入q,将自动退出
exit 0