title: Get content of web pages and compare
body: <p>can someone help/correct me to write a shell script, here is what i'm trying to do </p>
  
  <ul>
  <li>get content of web pages</li>
  <li>compare content</li>
  <li>if the content are same then return 0</li>
  <li>if not return 2</li>
  </ul>
  
  <p>here is my code </p>
  
  <pre><code>for cluster in $CLUSTERS
  do
      for applis in $(eval echo \$${cluster}_APPLIS)
      do
         CONTENT=$(wget -q -O - "http://$server/$applis")
         if [ "$CONTENT" -eq 1 ]
         then
         exit_code=0
         else
         exit_code=2
         fi
       done
  done
  
  [[ -z "$error_server" ]] &amp;&amp; error_server="aucune"
  
  case $exit_code in
      "2")
              echo "CRITICAL - App Version Mismatch"
              exit 2
              ;;
      "1")
              echo "WARNING - instance(s) indisponible(s)"
              exit 1
              ;;
      "0")
              echo "OK - All apps have the save version"
              exit 0
              ;;
      *)
              echo "CRITICAL - there's something wrong with this script ..."
              exit 2
              ;;
  esac
  </code></pre>
  
  <p>Any help or suggestions would be much appreciated </p>
  
  <p>Regards
  Fab</p>