I'm trying to write a function that rewrites a value according to a user's choice. So far it looks like this:
while [[ $code_id != [1-28] ]]; do
echo "Please select a value..."
echo "1. A"
echo "2. B"
echo "3. C"
echo "4. D"
...
echo "28. Z"
done
echo "INFO: Code is $code_id."
The user should write a chosen number (1-28). But as a result, code returns me, for a choice. I understand what reason in a condition (while... do), but how I should write this for my code to work?
code_id
and (2)[1-28]
matches digits 1,2 and 8 only - it is not a numeric range from 1 to 28. Perhaps you are looking for a select loop?$code_id = [1-9]
i can go in a next stage, but another ([1-10]
, for example) - this stage is repeating.