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". ano 1731522228 forget ano 1731522240 learn "grep -q" is typically more efficient than "grep >/dev/null". Most grep implementations will stop reading, and exit with a zero exit status at the first match, even if an error was occurred. 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". larryv 1731527453 forget larryv 1731527460 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".