bash: testing conditions using if-grep
Aug.28, 2009 in
Think Linux
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












Leave a Reply