mirror of
https://github.com/notwa/rc
synced 2024-11-05 04:29:03 -08:00
add xxp utility
This commit is contained in:
parent
5191fb4a60
commit
235c9d9ce2
1 changed files with 23 additions and 0 deletions
23
sh/xxp
Normal file
23
sh/xxp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH
|
||||
# YES_BASH
|
||||
# YES_DASH
|
||||
|
||||
xxp() { ### @-
|
||||
### act like `xxd -p`, but nicely formatted.
|
||||
###
|
||||
### **TODO:** support `-r` (reverse) argument.
|
||||
###
|
||||
### ```
|
||||
### $ xxd -p ~/rc/install | head -n2
|
||||
### 23212f7573722f62696e2f656e762073680a232074686973207363726970
|
||||
### 7420697320636f6d70617469626c65207769746820666f6c6c6f77696e67
|
||||
### $ xxp ~/rc/install | head -n2
|
||||
### 23 21 2F 75 73 72 2F 62 69 6E 2F 65 6E 76 20 73
|
||||
### 68 0A 23 20 74 68 69 73 20 73 63 72 69 70 74 20
|
||||
### ```
|
||||
|
||||
hexdump -e '15 1 "%02X " 1 1 " %02X\n"' -- "$@"
|
||||
}
|
||||
|
||||
[ "${SOURCING:-0}" -gt 0 ] || xxp "$@"
|
Loading…
Reference in a new issue