test on command result 

$ if true; then echo yes; else echo no; fi
yes
$ if false; then echo yes; else echo no; fi
no
$ if echo something | grep .; then echo found; else echo no; fi
something
found