Re:CLI: Improved
by vitorbaptistaa on Thursday August 30, 2018 @10:08PM
(#17882378)
I'm not in my computer now, but doesn't "grep -v" solves your issue? If I remember correctly, it inverts the query, so it would return 0 if there wasn't a match.
[ Parent
| on HN ]
No, -v will return 0 unless every line matches:
$ cat > foo
here's
some
random
text
$ grep -v some foo; echo $?
here's
random
text
0
$ grep -v bar foo; echo $?
here's
some
random
text
0
$ grep -vE "(here's|some|random|text)" foo; echo $?
1