Translate

Archives

Korn Shell Ordinal Number Conversion

It is useful to be able to convert to and from ASCII ordinal numbers in scripts. Here is one way of doing it in Korn shell scripts.

To convert the character ‘F’ to it’s ASCII ordinal value:

$ print $(('F'))
70


To display the ASCII character associated with the ordinal number 70:

$ typeset -i8 c=70
$ printf "\${c#*#}n"
F

Comments are closed.