Decimal to Hex conversion on command line

Dan Egli ddavidegli at
Mon Sep 9 04:20:17 MDT 2013

Anyone know of a quick and easy way to convert decimal to hexidecimal on
the command line? Like if I have 0 through 255 and I want $D to contain the
decimal version, and $H to contain the hex version so that I could do
something like this:

D=0 while [ $D -lt 256 ] ; do

  <CONVERT $D to Hex $H>

echo Conversion complete, $D converted to $H

D=$(($D + 1));


And yes, that is an EXTREME oversimplification. But if I can manage to do
THAT, then I can do what I need the conversion for in the first place.

--- Dan

More information about the PLUG mailing list