Does the unix korn shell provide a function to convert text or character to hex eg. hex 31 32 37 33 34 35 35 36 36 37 value of characters 1273455667 Here i have written the code to display but i don't know how to store the result in a variablestr=1273455667for (( i=0; i < ${#str}; i++ ))doc=${str:$i:1}if [[ $c == ' ' ]]thenprintf [%s] %X\n   \'\ \'elseprintf [%s] %X\n $c \'$c\'fidone
How to convert text or character to hex in korn shell
scripting;ksh
If you have hexdump (which is pretty likely), you could do something like this:$ echo Hello, world! | hexdump -v -e '/1 [%_c]: ' -e '/1 %02X\n'[H]: 48[e]: 65[l]: 6C[l]: 6C[o]: 6F[,]: 2C[ ]: 20[w]: 77[o]: 6F[r]: 72[l]: 6C[d]: 64[!]: 21[\n]: 0AFor a simple space separated hex dump into a variable:$ v=$(printf %s 1273455667 | hexdump -v -e '/1 %02X ')$ echo $v31 32 37 33 34 35 35 36 36 37