[Toybox] [PATCH] xxd

Rich Felker dalias at libc.org
Fri Jun 26 11:38:53 PDT 2015


On Thu, Jun 25, 2015 at 04:23:39PM -0700, enh wrote:
> On Thu, Jun 25, 2015 at 3:54 PM, Rob Landley <rob at landley.net> wrote:
> 
> > On 05/09/2015 11:36 PM, enh wrote:
> > > i've long been a hexdump(1) user, but someone on my team habitually uses
> > > xxd(1) and seeing that it was bi-directional was enough to switch my
> > > alleigance. this patch doesn't add that part, but it does cover the
> > > basic use cases.
> > >
> > > (right now Android just has a shell function 'hd'.)
> >
> > Sigh. I did od because posix said to
> > (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html)
> 
> (stupid posix. though at least one person on Android was pleased to see od,
> so i guess it's not as dead as i'd assumed.)

This isn't "stupid posix". It's the one portable way to process binary
input in a shell script, and it actually works in practice. See my
examples in: http://www.etalabs.net/sh_tricks.html

Using this technique, you can actually implement arbitrary binary
processing tasks (albeit with rather poor performance) in shell
script.

Rich

 1435343933.0


More information about the Toybox mailing list