[ovs-dev] [bugfixes 1/4] Avoid using "grep -q" outside of GNU/Linux specific utilities.
Ben Pfaff
blp at nicira.com
Wed Dec 8 23:22:43 UTC 2010
According to the Autoconf manual, "grep -q" is not portable, so instead
redirect stdout to /dev/null.
---
Makefile.am | 2 +-
tests/ovsdb-tool.at | 2 +-
utilities/ovs-pki.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8517b2b..457513c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -88,7 +88,7 @@ SUFFIXES += .in
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
-e 's,[@]ovsdbmonitordir[@],$(ovsdbmonitordir),g' \
> $@.tmp
- @if head -n 1 $@.tmp | grep -q '#!'; then \
+ @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
echo chmod +x $@.tmp; \
chmod +x $@.tmp; \
fi
diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at
index 7f09d34..c2ec881 100644
--- a/tests/ovsdb-tool.at
+++ b/tests/ovsdb-tool.at
@@ -45,7 +45,7 @@ AT_CHECK([[ovsdb-tool transact db '
AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0],
[[[{"uuid":["uuid","<0>"]},{}]
]])
-AT_CHECK([grep -q "add row for 5" db])
+AT_CHECK([grep "add row for 5" db], [0], [ignore])
AT_CLEANUP
AT_SETUP([ovsdb-tool compact])
diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in
index 1f52869..9a55961 100755
--- a/utilities/ovs-pki.in
+++ b/utilities/ovs-pki.in
@@ -361,7 +361,7 @@ fingerprint() {
file=$1
name=${1-$2}
date=$(date -r $file)
- if grep -q -e '-BEGIN CERTIFICATE-' "$file"; then
+ if grep -e '-BEGIN CERTIFICATE-' "$file" > /dev/null; then
fingerprint=$(openssl x509 -noout -in "$file" -fingerprint |
sed 's/SHA1 Fingerprint=//' | tr -d ':')
else
--
1.7.1
More information about the dev
mailing list