title: Detect empty input arg in bash script
body: <p>I have a script that has a given number of input variables.
  I would like to detect if all of the variables have been given and quit otherwise.
  For example lets say the script has 10 input args but only 6 are given.
  Then I would like to quit.
  I tried</p>
  <pre><code>arg1=$1
  arg2=$2
  ...
  arg10=$10
  for i in $(eval echo {$1..$10}); do
     echo &quot;$i&quot;
     if [[ -z &quot;$i&quot; ]]; then
         echo 'wrong number of args'
         exit 2
     fi
  done
  </code></pre>
  <p>The echo inside the loop (<code>echo &quot;$i$&quot;</code>) prints out but the loop always exits. So I have some basic flaw.</p>