in reply to How do I restrict a variable to a range of values?
Let me answer with a question of my own...
How does the variable know which values are okay?
That begs the answer, "I tell it." That implies you have a list of acceptable values, which you can also use to test against (probably with grep) later on. Follow?