linux shell判断字符串包含(类似于contains)

if echo "$string" | grep 'foo'; then
  echo "It's there!"
fi