#!/bin/bash cd ~/linuxcnc/scannout/multiscan if [ -p /tmp/CNCCaptureCtl ] then echo exit > /tmp/CNCCaptureCtl sleep 2 fi LAST=$(find . -maxdepth 1 -type d -printf "%p\n" | sed -e s/.\\///g | sort -g | tail -1) re='^[0-9]+$' if ! [[ $LAST =~ $re ]] ; then LAST=0 fi mkdir $(($LAST+1)) cnccapture -d -D /dev/v4l/by-id/usb-Etron_Technology__Inc._XWJ200-video-index0 ~/linuxcnc/scannout/multiscan/$(($LAST+1))/ & sleep 3 for i in {1..600} do if [ -f /tmp/CNCCaptureRdy ]; then break else sleep 0.1 fi done