2007/7/4, Peter Stuge <[EMAIL PROTECTED]>: > On Wed, Jul 04, 2007 at 07:47:11PM +0200, Uwe Hermann wrote: > > I use some aliases in my .bashrc which are pretty handy for converting > > HEX or BINARY or DECIMAL: > > > > alias HEX="ruby -e 'printf(\"0x%X\n\", ARGV[0])'" > > alias DEC="ruby -e 'printf(\"%d\n\", ARGV[0])'" > > alias BIN="ruby -e 'printf(\"%bb\n\", ARGV[0])'" > > > > (You can replace 'ruby' with 'perl' if you want) > > bash has printf too; try printf 0x%X\\n 128 >
Yes, printf at shell is very useful, I use this command to reset BIOS CMOS: # printf "\x2E" | dd bs=1 seek=112 of=/dev/port # printf "\xFF" | dd bs=1 seek=113 of=/dev/port It sends 0x2E to port 0x70 and 0xFF to port 0x71. > > //Peter > Alan -- linuxbios mailing list [email protected] http://www.linuxbios.org/mailman/listinfo/linuxbios
