I want to trap input to control the screenshot function.
vim myscreenshot.sh
screenshot(){
ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0+0,0 /tmp/out.mp4
}
close(){
echo "screenshot is over"
exit
}
trap 'screenshot' ctrl+a #how to fix it?
trap 'close' ctrl+b #how to fix it?
THe command trap 'screenshot' SIGINT can trap ctrl+c.
My requirement:input ctrl+a start screenshot function,ctrl+b stop screenshot function and exit after running bash myscreenshot.sh & in background.