The reason is hidden inside this statement from the documentation (man parallel
)
GNU parallel makes sure output from the commands is the same output as you would get had you run the commands sequentially. This makes it possible to use output from GNU parallel as input for other programs.
Reading on, you can find
--group
Group output. Output from each jobs is grouped together and is only printed when the command is finished. stderr (standard error) first followed by stdout (standard output). [...] if it is acceptable that the outputs from different commands are mixed together, then disabling grouping with -u
can speedup GNU parallel [...]
--group
is the default. Can be reversed with -u
In your situation what's happening is that because inotifywait -m
doesn't exit, parallel
will collect its output forever. When inotifywait -m
finished (which it never does), parallel
would then output all the data it had processed.
You can "fix" this with the --ungroup
(-u
) flag
--ungroup
| -u
Ungroup output. Output is printed as soon as possible and by passes GNU parallel internal processing. This may cause output from different commands to be mixed thus should only be used if you do not care about the output.
Thus,
inotifywait ./input -e close_write | parallel --ungroup --max-args=1 echo {1}
find ./inpuf -type f -print0 | parallel --null …
to keep the data clean.