Avoid using "grep -q" outside of GNU/Linux specific utilities.
authorBen Pfaff <blp@nicira.com>
Wed, 8 Dec 2010 22:23:54 +0000 (14:23 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 9 Dec 2010 01:09:29 +0000 (17:09 -0800)
According to the Autoconf manual, "grep -q" is not portable, so instead
redirect stdout to /dev/null.

Makefile.am
tests/ovsdb-tool.at
utilities/ovs-pki.in

index 8517b2b..457513c 100644 (file)
@@ -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
index 7f09d34..c2ec881 100644 (file)
@@ -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])
index 1f52869..9a55961 100755 (executable)
@@ -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