I wanna create 5 children function otrok {...} and run them in background. Children are writing in mkfifo $kanal. After all children are done writing I wanna kill tail process.
Basically this code works as expected, except I don't know how to get tail PID.
( tail -f $kanal >> cats & ) for i in $(seq 1 5); do ( otrok $i ) & done wait #wait for all "( otrok $i ) &" to exit #DOTO #kill tail in first line