title: How to provide an error message if user input doesn't match options given?
body: <p>I have a script that looks something like this.</p>
  <pre><code>until [[ &quot;${answer}&quot; = &quot;exit&quot; ]]
  do
  if [[ &quot;${answer}&quot; = &quot;&lt;option a&gt;&quot; ]]
  then
      &lt;input some text&gt;
  fi
  if [[ &quot;${answer}&quot; = &quot;&lt;option b&gt;&quot; ]]
  then
      &lt;input some other text&gt;
  fi
  done
  </code></pre>
  <p>My problem is that I want to provide an error message if the user types in anything that doesn't match the options given, and I can get it to do that, but it will still provide the error message when the user types anything in after triggering one of the conditional if/then statements.<br>I tried doing something like this under my until/do statement.</p>
  <pre><code> if [ &quot;${answer}&quot; != &quot;&lt;option a&gt;&quot; ] || [ &quot;${answer}&quot; != &quot;&lt;option b&gt;&quot; ]
   then
       echo &quot;Invalid input&quot;
  </code></pre>
  <p>But it still returns the error message due to the requested input in the various if/then statements.</p>
  <p>Any suggestions?</p>