summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-07-22 11:40:21 +0200
committerSimon Rettberg2021-07-22 11:40:21 +0200
commite8b875ec5320319910b0966446631cfa8fc6d8ec (patch)
treed3a96626604010a120755092663975d168e1c960
parent[dev] Add support for xxd without -e (diff)
downloadslx-tools-e8b875ec5320319910b0966446631cfa8fc6d8ec.tar.gz
slx-tools-e8b875ec5320319910b0966446631cfa8fc6d8ec.tar.xz
slx-tools-e8b875ec5320319910b0966446631cfa8fc6d8ec.zip
dev: Workaround for trailing spaces in busybox xxd output
-rw-r--r--modules/dev.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/dev.inc b/modules/dev.inc
index fcde631..3330741 100644
--- a/modules/dev.inc
+++ b/modules/dev.inc
@@ -205,9 +205,9 @@ __init() {
local t
# init __hex2bin
t="7a32337465737431323374657374"
- if [ "$( printf z23test123test | xxd -p )" = "$t" ]; then
+ if [ "$( printf z23test123test | xxd -p | tr -d '\n ' )" = "$t" ]; then
#echo "Using xxd" >&2
- __bin2hex() { xxd -p; }
+ __bin2hex() { xxd -p | tr -d '\n '; }
elif [ "$( printf z23test123test | od -t x1 -An | tr -d '\n ' )" = "$t" ]; then
#echo "Using od" >&2
__bin2hex() { od -t x1 -An | tr -d '\n '; }