在脚本中使用重定向输入

5年以前  |  阅读数:482 次  |  编程语言:Shell 
#!/bin/bash
# redirecting the inpiut

# 从test中读取数据,而不是从STDIN中读取数据
exec 0< test
count=1
while read line
do
    echo "Line #$count : $line "
    count=$[ $count +1 ]
done

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8