- 讀取輸入到name變量
read -p "please enter you name:" name
- 超時(shí)5秒
read -t 5 -p "please enter you name:" name
- 讀取多個(gè)變量
read -p "Please input params:" val1 val2
- 讀取文本
#!/bin/bash
# reading data from a file
count=1
cat test | while read line
do
echo "Line $count: $line"
count=$[ $count + 1 ]
done
echo "Finished processing the file"