title: BASH getopts define what $OPTARG can be
body: <pre><code>usage ()
  {
  echo "USAGE MANUAL"
  echo "-u -&gt; displays this usage manual"
  echo "-t -&gt; sets EXEC variable to echo"
  echo "-t -&gt; sets DEPTH variable to inputed string" 
  exit 1
  }
  while getopts ":t:u:d:" o; do
  case "${o}" in
  t)
      EXEC=echo
      ;;
  d)  
      DEPTH=${OPTARG}
      ;;            
  u)
      usage
      ;;
  esac
  done
  shift $((OPTIND-1))
  
  if [ -z "${d}" ] || [ -z "${t}" ]; then
  usage
  fi
  </code></pre>
  
  <p>If i get it right if i do this:</p>
  
  <pre><code>./script -d
  </code></pre>
  
  <p>I have to provide something like:</p>
  
  <pre><code>./script -d full
  </code></pre>
  
  <p>The question is, how do i restrict what the argument of d can be. Like if someone types <code>./script -d full</code>  or <code>./script -d empty</code> its gonna change the value of DEPTH to full or empty, but if they put something like <code>./script -d infinite</code> the script doesnt run and echo somthing like wrong argument provided.</p>