title: How to find if value is not present in array then write missing value to variable?
body: <p>I have some known values: <code>10 20 30 40 50 60 70</code>. I have an array containing some output generated by a command.  I want to find if any of the known values are missing in the array, if so write the first missing value to a variable. </p>
  
  <p>For example, the first value missing in the array is <code>20</code>, so I want to set <code>variable=20</code>.</p>
  
  <p>I have tried various methods to do this, but my limited bash knowledge is not helping here. Looping through multiple arrays, looping through statements. I don't have any working code.</p>
  
  <pre><code>array=( 1 2 10 30 40 )
  
  if [ "$i" -ne "10" ] ; then
      variable="10"
      break
  elif [ "$i" -ne "20" ] ; then
      variable="20"
      break
  elif [ "$i" -ne "30" ] ; then
      variable="30"
      break
  elif [ "$i" -ne "40" ] ; then
      variable="40"
      break
  elif [ "$i" -ne "50" ] ; then
      variable="50"
      break
  elif [ "$i" -ne "60" ] ; then
      variable="60"
      break
  elif [ "$i" -ne "70" ] ; then
      variable="70"
      break
  else
      echo "no values available"
      exit 1
  fi
  </code></pre>