I am trying to implement a simple log server in Bash. It should take a file as a parameter and serve it on a port with netcat.
( tail -f $1 & ) | nc -l -
Write tail's PID to file descriptor 3, and then capture it from there.
( tail -f $1 & echo $! >&3 ) 3>pid | nc -l -p 9977 kill $(