July 22, 2004

[Shell] dec2hex hex2dec

dec2hex
#!/bin/sh
printf "%X\n" $1

hex2dec (bash only)
#!/bin/sh
echo $((0x$1))

Posted by pank at July 22, 2004 10:09 AM
Comments

Very useful! I usually put hex #s in filenames for organizational purposes. Also good for finally finding out what "DEADBEEF" is in decimal!

Thanks!

Posted by: Johnny at September 7, 2004 03:47 PM
Post a comment













Remember personal info?