linux - How to convert decimal to hex in bash? -


this question has answer here:

i have decimal number in bash shell:

linux$ a=67 

how print 67 hexadecimal in bash?

as bash program:

#!/bin/bash   decimal1=31  printf -v result1 "%x" "$decimal1"  decimal2=33  printf -v result2 "%x" "$decimal2"  echo  $result1 $decimal1 echo  $result2 $decimal2 

or directly bash shell:

el@defiant ~ $ printf '%x\n' 26 1a el@defiant ~ $ echo $((0xaa)) 170 el@defiant ~ $  

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -