bash: testing conditions using if-grep

this expr can be really useful to determine if a term has been found or not using grep. short and sweet enough for me.

if [ ! -z $(echo $var | grep “cond”) ]; then echo “found”; else echo ” not found”; fi

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.