Use grep to match a term for an if test Mar 16, 2011 • Noel if echo -e "Hello\nWorld" | grep -q "ell" ; then echo "Hello was matched" else echo "World was matched" fi > Hello was matched