Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not true. This is grep's default behavior. From https://linux.die.net/man/1/grep:

> Normally, the exit status is 0 if selected lines are found and 1 otherwise.

    $ touch bar
    $ grep foo bar
    $ echo $?
    1


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: