Skip to content

Instantly share code, notes, and snippets.

@robertfairley
Created May 18, 2018 19:54
Show Gist options
  • Save robertfairley/a5526069410e16d28f40d689f450c2f4 to your computer and use it in GitHub Desktop.
Save robertfairley/a5526069410e16d28f40d689f450c2f4 to your computer and use it in GitHub Desktop.

Revisions

  1. robertfairley created this gist May 18, 2018.
    20 changes: 20 additions & 0 deletions hex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/usr/bin/env bash

    ##################################################
    # #
    # Shorthand for a hex dump of a file on POSIX #
    # if the program exists on your system #
    # #
    ##################################################

    FILE=$1

    usage() {
    echo "usage: hex <filename>"
    }

    if [[ $# -lt 1 ]]; then
    usage
    else
    hexdump -C -n128 $FILE
    fi