title: bash script checking for installed fonts from list in an array and for loop to do commands
body: <p>Updated with working code</p>
  
  <p>I am trying to check for installed fonts listed in ${fontArray} one by one and add any that are not found to a new array ${missingFonts} that I can print later as part of a much longer "post-build health check" run on each machine in my environment.</p>
  
  <pre><code>    Var19="Fonts"
  fontArray=("font1" "font2" "font3")
  missingFonts=()
  for i in "${fontArray[@]}"; do
      system_profiler SPFontsDataType | grep "Full Name: $i" | sed 's/.*: //'
      if ! system_profiler SPFontsDataType | grep -q "Full Name: $i"; then 
          missingFonts+=("$i");
      fi
  done
  
  if [ ${#missingFonts[@]} -eq 0 ]; then
      Val9="Fonts Installed"
      Check19=PASS
  else
      Val19="Missing Fonts: ${missingFonts[@]}"
      Check19=FAIL
  fi
  
  Line19=" | ${Check19} | ${Var19}        = ${Val19} "
  
  echo "$Line19"
  
  exit 0
  </code></pre>
  
  <p>which returns</p>
  
  <pre><code>| FAIL | Fonts      = Missing Fonts: font1 font2 font3
  </code></pre>
  
  <p>Thanks in advance for helping an old dog learn new tricks!</p>