Subject: [PATCH] tests: fix $? typo in null-byte

From: Paul Eggert <[email-masked]>
Date: Mon, 13 Jul 2015 16:11:11 -0700

* tests/null-byte: Don't assume $? survives an invocation of 'test'.
---
 tests/null-byte | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/null-byte b/tests/null-byte
index 27be99e..2419667 100755
--- a/tests/null-byte
+++ b/tests/null-byte
@@ -39,7 +39,9 @@ for left in '' a '#' '\0'; do
           printf "$pat\\n" >pat || framework_failure_
           for locale in $locales; do
             LC_ALL=$locale grep -f pat in
-            test $? -eq 0 || test $? -eq 1 || fail_ "'$pat' caused an error"
+            status=$?
+            test $status -eq 0 || test $status -eq 1 ||
+              fail_ "'$pat' caused an error"
             LC_ALL=$locale grep -a -f pat in | cmp -s - in ||
               fail_ "-a '$pat' does not match '$data'"
           done
-- 
2.1.0