summaryrefslogtreecommitdiff
path: root/tests/misc/od-endian.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-07-14 02:49:47 +0100
committerPádraig Brady <P@draigBrady.com>2014-07-14 02:49:47 +0100
commit37b36018d3f5f276622a9888e32623f9410a80e0 (patch)
tree3996f5ad061acf3c222993b52966a953f19a3900 /tests/misc/od-endian.sh
parent39f79234a173c471ff20a0bb0e49cb47b5d96f3c (diff)
downloadcoreutils-37b36018d3f5f276622a9888e32623f9410a80e0.tar.xz
tests: fix portabilitiy issue in new od-endian test
* tests/misc/od-endian.sh: '\n' is not generally supported in the replacement, so use the more portable "\\$NL".
Diffstat (limited to 'tests/misc/od-endian.sh')
-rwxr-xr-xtests/misc/od-endian.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/misc/od-endian.sh b/tests/misc/od-endian.sh
index 5ee17e617..a01ae0a80 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