Hi! First go on LQ so I'm hoping someone can help. Basically I want to record a webcam stream with a given filename set as a variable ($USERINPUTNUM), stop that recording when a user enters a number (eg. 123456) and hits enter, then begin recording again under the new number they've entered (eg. 678910). Here's what I've got so far, but the user has to Ctrl+C out of it first - I just need them to be able to enter the new number followed by Enter to stop the previous recording and start the next.
Any ideas? Here's the script so far... (quite new to this just to warn!):
Code:
#!/bin/bash
while true
do
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
ENDCOLOUR="\033[0m"
TIMESTAMP=$(date +"%Y.%m.%d_%H.%M")
read -p "Scan your barcode and get packing: " USERINPUTNUM
echo -e $YELLOW"Saving order process..."$ENDCOLOUR
avconv -f video4linux2 -r 3 -fs 52428800 -i /dev/video0 /home/$USER/records/$TIMESTAMP-$USERINPUTNUM.avi
echo -e $BLUE"Video recording complete, keep going!"$ENDCOLOUR
done
Thanks