printf "%x\n" 255    #this prints out "ff"
printf "%.4x\n" 255  #or if you need a fixed field width number use this

