When we launch the channel, each command is executed in a separate process. The interpreter is waiting for the latter, but if we use ampersand (&).
cmd1 | cmd2 &
pid , , , . , bash , bash ( 'dir', 'file' done. :
ps
echo "azerty" | while read line; do ps; done
, , EOF.
, SIGPIPE ( ), . ... .
"$!" pid , . bash, while.
pid "inotifywait" . uggly:
(inotifywait ... & echo "$!">inotifywait.pid) | \
while read dir file event
do
done &
cat inotifywait.pid
pid, , , -t inotifywait:
(while true; do inotifywait -t 10 ...; done)| \
while read dir file event
do
done &
kill "$!"
. ? , .