Hi @easyt50,
with your example, with all the information from @Akito and @ 01101111, I tried to make a different script to you.
#!/bin/bash
clear
unset ty
echo "1=mp4, 2=avi, 3=wmv, 4=VOB, 0=exit"
while ! [[ $ty =~ ^[0-4]+$ ]] # loop until the regular expression is true
do
read -srn 1 ty # -r= use "raw input" -s= do not echo keystrokes -n 1=stop reading after 1 character has been read
read -srt 0.1 debounce # optional: to avoid visible characters when pressing several keys at the same time
done
case $ty in
1)
mf="mp4";;
2)
mf="avi";;
3)
mf="wmv";;
4)
mf="VOB";;
0)
exit 0
esac
printf "Selected number=%s - Chosen option=%s\n" $ty $mf
# put your code here ...
exit 0
Note: Please correct my code, because I’m not a programmer and I don’t even know how to program in bash