Bash True If Grep Has Output

[Solved] Bash True If Grep Has Output | Basic - Code Explorer | yomemimo.com
Question : bash true if grep has output

Answered by : blushing-booby-bwnqpljc0bp0

if grep -q PATTERN file.txt; then echo found
else echo not found
fi

Source : https://unix.stackexchange.com/questions/48535/can-grep-return-true-false-or-are-there-alternative-methods | Last Update : Thu, 12 Aug 21

Answers related to bash true if grep has output

Code Explorer Popular Question For Basic