title: Handling gcc warnings and output in a Bash Script
body: <p>So I am new to the whole Bash scripting scene, but I am working on a script to compile all the .c files in a directory which I have succeeded in doing so by:</p>
  
  <pre><code>    for F in *.c; do
        gcc -c -Wall -o ${F%.c} $F
      done
  </code></pre>
  
  <p>Everything works fine, but I want to the output to look something like:</p>
  
  <pre><code>ex1.c Errors
  ex2.c OK
  ex3.c Warnings
  </code></pre>
  
  <p>So basically I want to have an exit status of 0 (Everything went fine) for "Ok", status 1 (Warnings, but no error) for "Warnings" and status 2 (Did not compile) for "Errors".</p>
  
  <p>I am having a hard time figuring out how to do such a thing. I've searched around and couldn't find anything that I have found to be useful. I very well could have overlooked something though.</p>
  
  <p>EDIT: Would there be anyway to say: if gcc -Wall file.c has errors, then just say Error instead of the full GCC error handling message? Same with warnings and a perfect compile?</p>