Grep Quiet Mode
We can use -q, --quiet
argument which tells grep
to run in quiet mode and not display anything on standard output. If a match is found, grep
will exit with a status code of 0
.
Example
Here, since grep
found pattern "3", it exited with 0
exit code without displaying anything.
Here, grep
had non-zero exit code since pattern "6" could not be found.
Source: Linuxize
Last updated