]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix portabilitiy issue in new od-endian test
authorPádraig Brady <P@draigBrady.com>
Mon, 14 Jul 2014 01:49:47 +0000 (02:49 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 14 Jul 2014 01:49:47 +0000 (02:49 +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

index 5ee17e6179522225453f4ba767ad9663c78e4d92..a01ae0a805c449d247bbc7ec5c813b0ddabd1989 100755 (executable)
@@ -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