The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-06-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
Not sure where 97 came from for "A". maybe you mean lower case "a".
See: man ascii .

A = 101 in octal
A = 41 in hexadecimal
A = 65 in decimal

a = 141 in octal
a = 61 in hexadecimal
a = 97 in decimal

If you actually mean lower case a, you can use "bc" to change number bases from decimal to octal then use shell echo to display the character.

#!/bin/ksh
CHAR=97
OCT=`echo "obase=8;ibase=10;${CHAR}"|bc`
echo "\0${OCT}"

a