coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: fix portabilitiy issue in new od-endian test


From: Pádraig Brady
Subject: [PATCH] tests: fix portabilitiy issue in new od-endian test
Date: Mon, 14 Jul 2014 02:52:16 +0100

* tests/misc/od-endian.sh: '\n' is not generally supported
in the replacement, so use the more portable "\\$NL".
---
 tests/misc/od-endian.sh |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/misc/od-endian.sh b/tests/misc/od-endian.sh
index 5ee17e6..a01ae0a 100755
--- a/tests/misc/od-endian.sh
+++ b/tests/misc/od-endian.sh
@@ -21,15 +21,18 @@ print_ver_ od
 
 in='0123456789abcdef'
 
+NL='
+'
+
 # rev(1) is not generally available, so here's a simplistic
 # implementation sufficient for our purposes.
 rev() {
   while read line; do
-    printf '%s' "$line" | sed 's/./&\n/g' | tac | paste -s -d ''
+    printf '%s' "$line" | sed "s/./&\\$NL/g" | tac | paste -s -d ''
   done
 }
 
-in_swapped() { printf '%s' "$in" | sed "s/.\{$1\}/&\\n/g" | rev | tr -d '\n'; }
+in_swapped() { printf '%s' "$in" | sed "s/.\{$1\}/&\\$NL/g" | rev |tr -d '\n'; 
}
 
 for e in little big; do
   test $e = little && eo=big || eo=little
-- 
1.7.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]