How to Convert ASCII to Character in KSHby Brian Kadigan
Ksh is an abbreviation for the Korn shell, a command interpreter for Unix and Linux operating systems. Ksh, as with all command-line interfaces, accepts typed commands from the user, executes them, and returns the output from these commands.
American Standard Code for Information Interchange is a globally-recognized standard for representing text and other characters in a numerical form that computers can recognize. Each symbol in the ASCII character set has a number associated with it -- binary, octal, decimal, or hexadecimal. In Ksh, the Unix "printf" command can be used to easily convert the number to its associated character.
Ensure that Ksh is installed on your system; if not, install it using the package manager specific to your system.
Open a Ksh window.
Type the following at the command prompt:
This example will output the "at" symbol, "@," followed by a newline ("\n"). 40 is the hexadecimal ASCII address for the "@" sign. For the particular character you want, use the character's hex address in place of "40" in the above.
- check You can also use an octal address by typing the following, replacing "xxx" with the octal value:
- check printf '\xxx\n'
Items you will need
- photo_camera Comstock/Comstock/Getty Images
Click here to provide feedback on this article