How to check if a string has spaces in Bash shell

case "$var" in  
     *\ * )
           echo "match"
          ;;
       *)
           echo "no match"
           ;;
esac

You can use regular expressions in bash:

string="a b '' c '' d"
if [[ "$string" =~ \ |\' ]]    #  slightly more readable: if [[ "$string" =~ ( |\') ]]
then
   echo "Matches"
else
   echo "No matches"
fi

Edit:

For reasons obvious above, it's better to put the regex in a variable:

pattern=" |'"
if [[ $string =~ $pattern ]]

And quotes aren't necessary inside double square brackets. They can't be used on the right or the regex is changed to a literal string.