I have a problem.
I must represent each number with exactly 2 digits (i.e. 0F instead of F)
my code looks something like that:
1. read number of ascii chars are in an environment variable (using wc -w)
2. converting this number to hexadecimal (using bc).
How can I make sure the number I’ll get after stage 2 will include a leading 0 (if necessary)
Thanks,
Amigal
Run it through
printf:If you have the digits of the number only in a variable, say
$NUMBER, you can concatenate it with the required0xprefix directly: