1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/sh # fq - tail -F the queue outputs, quitting when the job finishes tailed=false for f in ${NQDIR:-.}/,*; do if ! nq -t $f; then tailed=true printf '==> %s\n' "$f" tail -F $f & p=$! nq -w $f kill $p fi done if ! $tailed; then cat $f fi