|

楼主 |
发表于 2007-12-2 17:40:03
|
显示全部楼层
Post by ocean390;1790513
不是[ -s tmp/pipe ]对管道文件不正常,而是根本就不会执行到这里,shell执行的时候会先处理重定向,当它试图打开tmp/pipe时就被阻塞了。
谢谢!功力很深!
改写了代码:
if [ -s tmp/pipe ]
then
while read
do
:
done <tmp/pipe
fi
我原来的代码是
if [ -s tmp/pipe ]
then
cat tmp/pipe
fi
后来,觉得cat来处理效率低,就改用while read 的结构,没想到有重定向的问题,也弄不明白是什么问题。再次谢谢楼上! |
|