]> git.ipfire.org Git - thirdparty/man-pages.git/commit
src/bin/grepc: Use the same error code as grep(1)
authorAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 22:38:20 +0000 (23:38 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sun, 2 Nov 2025 17:52:48 +0000 (18:52 +0100)
commitef01a3e3ef0f486c6872cd03fa92d00d8a931b7e
tree0ee8855a363fb62a43438b0eb5e49aa2dd8c712f
parentbbedf8d1c05186f8ca39dec48507898e551e3895
src/bin/grepc: Use the same error code as grep(1)

Exit with 2 on error.

If nothing matches, it's a success, and it exits with 0 normally.
This is different from grep(1), but I don't know how to write
the script to exit with 1 if nothing matches.

This implementation may also ignore some xargs(1) errors.  A future
commit --with code suggested by Paul Eggert-- will fix this.

Link: <https://software.codidact.com/posts/294883>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/bin/grepc