Hi guys,
I'm not sure what the policy is here on asking followup questions. So please excuse me if i'm breaking protocol. Earlier I was constructing a menu in bash ( Here )
And so far I've got it working really good. Code here.
while [[ 1 ]]
do
cat -n "$dumpfile"
read -p "Please make a selection, select q to quit: " choice
case $choice in
# Check for digits
[0-9] ) dtvariable=$(sed -n "$choice"p "$dumpfile")
$dtvariable ;;
q|Q)
break
;;
*)
echo "Invalid choice"
;;
esac
done
Except - that works great for menu items up to 9. The menu will be dynamic - could have 1 item, 20 items, or 197 items. I've tried changing [0-9] to be [0-9][0-9] to see if it would take 12. But it doesn't. Can anyone put me on the right path? I suppose I could just remove the [0-9] part and take anything that is not q. But wouldn't it be better to look for numbers?
Thank you in advance.