tests/invocation: Use ggrep if available

We use grep -o here to filter output, but that's not available on
OpenIndiana.

It does offer "ggrep" though, which is GNU grep.
This commit is contained in:
Fabian Homborg 2019-02-13 13:49:53 +01:00
parent c1d042051c
commit 2614deb138

View File

@ -139,7 +139,13 @@ filter() {
if [ -f "$1" ] ; then
# grep '-o', '-E' and '-f' are supported by the tools in modern GNU
# environments, and on OS X.
grep -oE -f "$1"
#
# But not on OpenIndiana/Illumos, so we use ggrep if available.
if command -v ggrep >/dev/null 2>&1; then
ggrep -oE -f "$1"
else
grep -oE -f "$1"
fi
else
cat
fi