Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
4e4a6d83
Commit
4e4a6d83
authored
Feb 10, 2017
by
neilpang
Browse files
better hexdump
fix
https://github.com/Neilpang/acme.sh/issues/595
parent
34f25fa5
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
4e4a6d83
...
@@ -364,8 +364,16 @@ _ascii_hex() {
...
@@ -364,8 +364,16 @@ _ascii_hex() {
#input:"abc"
#input:"abc"
#output: " 61 62 63"
#output: " 61 62 63"
_hex_dump() {
_hex_dump() {
#in wired some system, the od command is missing.
if _exists od; then
if
!
od
-A
n
-v
-t
x1 |
tr
-d
"
\r\t
"
|
tr
-s
" "
|
sed
"s/
$/
/"
|
tr
-d
"
\n
"
2>/dev/null
;
then
od -A n -v -t x1 | tr -s " " | sed 's/ $//' | tr -d "\r\t\n"
elif _exists hexdump; then
_debug3 "using hexdump"
hexdump -v -e '/1 ""' -e '/1 " %02x" ""'
elif _exists xxd; then
_debug3 "using xxd"
xxd -ps -c 20 -i | sed "s/ 0x/ /g" | tr -d ",\n" | tr -s " "
else
_debug3 "using _ascii_hex"
str=$(cat)
str=$(cat)
_ascii_hex "$str"
_ascii_hex "$str"
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment