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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…