title: How do I deal with empty user input in a Bash script?
body: <p>When the script asks me for input, I get an error if I just press Return without typing in anything. How do I fix this?</p>
  
  <p>Here's the script:</p>
  
  <pre><code> #!/bin/bash
  
     SUM=0
     NUM=0
  
     while true
     do echo -n "Pruefungspunkte eingeben ('q' zum Beenden): "
        read SCORE
        if test "$SCORE" == "q"
        then echo "Durchschnittspunktzahl: $AVERAGE."
             break
        else SUM=`expr $SUM + $SCORE`
             NUM=`expr $NUM + 1`
             AVERAGE=`expr $SUM / $NUM`
        fi
     done
  </code></pre>