Also, echo is a buildtin, so dont use absolute path for it
> On 13 Nov 2015, at 20:54, Dimitris Papastamos <s...@2f30.org> wrote: > >> On Fri, Nov 13, 2015 at 02:52:17PM -0500, Greg Reagle wrote: >> Okay then. It no longer depends on xxd. It depends on od for the hex dump >> (works with both GNU od and sbase od) and echo, awk, tr, cut for the reverse >> hex dump. > >> #!/bin/sh >> [ -z "$1" -o -z "$2" ] && { echo "$0 infile outfile"; exit 1; } >> [ -z "$EDITOR" ] && { echo "\$EDITOR must be defined"; exit 1; } >> >> tmpfile=$(mktemp) || exit 1 >> infile="$1" >> outfile="$2" >> >> od -Ax -tx1 "$infile" | head -n -1 > $tmpfile >> $EDITOR "$tmpfile" >> /bin/echo -ne $(tr -s ' ' < "$tmpfile" | cut -d' ' -f2-17 | awk '{for (i=1; >> i<=NF; i++) printf "\\x%s", $i}') > $outfile >> rm "$tmpfile" > > echo -e is evil, use printf(1) >