cat pipe.sh
#!/bin/bash
fifo_file=fifo.pipe
mkfifo $fifo_file
exec 6<>$fifo_file
rm $fifo_file
DateWrite ()
{
i=0
while [ $i -lt 1000 ]
do
str=`date`
i=$(( i+1 ))
echo "$i $str"
done
}
for (( i=0; i<100; i++ ))
do
( DateWrite >&6 ) &
done
while read date_time
do
echo $date_time >> output.file
done <&6
兩個問題,
1。為何要rm $fifo_file ,洗掉這個檔案后,不影響運行嗎?
2。如何修改一下,讓這個程式可以正常退出?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/51255.html
標籤:其他開發語言
上一篇:[pycharm] 提問:Process finished with exit code -1
下一篇:pyinstaller打包問題
