plinc.sh: better implementation