How can I, in a bash script, have a variable that takes user input of no more than 300 characters, and displays the number of characters left as the user types?
In this case the characters will be numbers corresponding to a feed from get-iplayer, with a maximum of 4 characters in a block separated from the next by a space.
The relevant script follows -
{
read -n1 -p "Do you want to download some tv programmes? [y/n/q] " ynq ;
case "$ynq" in
[Yy]) echo
read -n300 -p "Please input the tv programme numbers to download [max 300 characters] " 'tvbox'
echo
cd /media/$USER/back2/proggies/
/usr/bin/get-iplayer --get $tvbox
;;
[Nn]) echo;; # moves on to next question in the script
[Qq]) echo; exit;; # quits
* ) echo "Thank you ";;
esac
};