#!/bin/sh

trap cleanup 1 2 3 6 9 11
cleanup() {
    kill $PID 2>/dev/null
    exit
}

test -p "${NNN_FIFO}" || exit 1

while read line
    kill $PID 2> /dev/null
    wait
    nsxiv -N tabbed $line &
    PID=$!
do
done < "${NNN_FIFO}"
