summaryrefslogtreecommitdiff
path: root/posix-shell
diff options
context:
space:
mode:
Diffstat (limited to 'posix-shell')
-rw-r--r--posix-shell/utils.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/posix-shell/utils.sh b/posix-shell/utils.sh
index b1ffc21..f19602d 100644
--- a/posix-shell/utils.sh
+++ b/posix-shell/utils.sh
@@ -225,3 +225,21 @@ lar() {
popd
rm -rf "$temp"
}
+
+hexdiff() {
+ if test "$#" -ne 2
+ then
+ echo "Usage: hexdiff <file1> <file2>"
+ return 1
+ fi
+
+ dump1="$(mktemp)"
+ dump2="$(mktemp)"
+
+ hexdump -C "$1" > "$dump1"
+ hexdump -C "$2" > "$dump2"
+
+ diff --unified=4 --color=always "$dump1" "$dump2"
+
+ rm -f "$dump1" "$dump2"
+}