Why does this code work correctly, while the other version of the same condition doesn't?
if grep -q string file; then
echo found
else
echo not found
fi
This doesn't work:
if [ ! `grep -q string file` ]; then
echo not found
else
echo found
fi
-q
does, or are you just blindly using it because you've seen others use it? – chepner Oct 21 '17 at 01:27