Month: November 2013

Make sense of grep exit status in Bash scripts

If you want to use grep results in bash scripts then it can get confusing. Because if grep returns a result then its exit status is 0; if it does not return anything the exit status is 1.

So these two line mean, if my script my_clever_script.pl is currently not running.

 

http://www.gnu.org/software/grep/manual/html_node/Exit-Status.html