greycat 1572286233 learn "grep -q" is typically more efficient than "grep >/dev/null". Most grep implementations will stop reading at the first match. kerframil 1582703970 forget kerframil 1582703977 learn "grep -q" is typically more efficient than "grep >/dev/null". Most grep implementations will stop reading at the first match. Similarly, "grep -q 'pattern' && echo matched" should be considerably more efficient than such long-winded methods as "count=$(grep 'pattern' | wc -l); (( count > 0 )) && echo matched".