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 -
Maybe you could use a fifo, so that you can capture the pid of the first process, e.g.:
FIFO=my_fifo rm -f $FIFO mkfifo $FIFO tail -f $1 > $FIFO & TAIL_PID=$! cat $FIFO | nc -l -p 9977 kill $TAIL_PID rm -f $FIFO