title: How to use contents of text file as input to shell script?
body: <p>I'm tasked with writing a shell script that takes in a string of 6 letters and numbers and checks if they meet a certain criteria.</p>
  
  <p>This is that script</p>
  
  <pre><code>FILE=$1
  var=${#FILE}
  if [ $var -gt 6 ] || [ $var -lt 6 ]
  then
      #echo $FILE "is not a valid NSID"
      exit 1
  else if ( echo $1 | egrep -q '^[A-Za-z]{3}\d{3}$' )
      then
          #echo $1 "is a valid NSID"
          exit 0
      else
          #echo $1 "is not a valid NSID"
          exit 1
      fi
  fi
  </code></pre>
  
  <p>It works. so that isn't where the problem is.</p>
  
  <p>What I am trying to do is use a "wrapper" script to gather potential valid NSID's from a text file and call that script on the list of inputs. so that if I call that script within my wrapper script it will step through the text file I have given my wrapper and check if each line is valid.</p>
  
  <pre><code>FILE=$1
  YES= more $FILE
  
  if ( exec /path/to/file/is_nsid.sh $YES -eq 0 )
  then
      echo $FILE "is a valid NSID"
  else
      echo $FILE "is not a valid NSID"
  fi
  </code></pre>
  
  <p>so if I called it with a text file called file1.txt which contained</p>
  
  <pre><code>yes123
  yess12
  ye1243
  </code></pre>
  
  <p>it would output whether each was valid or not.</p>