On 9/9/13 4:20 AM, Dan Egli wrote:
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));

done

Is it cheating to just use python?

> H=`python -c "import sys; print hex(int(sys.argv[1]))" 200`; echo $H
0xc8


-Dennis

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to