shell/理解输入和输出/在脚本中使用重定向输入.sh

13 lines
196 B
Bash
Raw Normal View History

2016-05-13 21:42:54 +08:00
#!/bin/bash
# redirecting the inpiut
# 从test中读取数据而不是从STDIN中读取数据
exec 0< test
count=1
while read line
do
echo "Line #$count : $line "
count=$[ $count +1 ]
done