Generating Octal/Hex Codes from Bourne Shell

Jim Knutson knutson at marconi.SW.MCC.COM
Fri Aug 19 01:44:46 AEST 1988


In article <118 at gillxp> rg at gillxp (Richard J. Gill) writes:
>		echo "\0212"	# 0x8a
>		 ...
>On my Fortune 32:16 (Forpro 2.0 - Sys 3v7 & BSD 4.3), however,
>the string is simply displayed as a literal.  Any ideas on how I
>can generate the fully ASCII set from the Bourne shell on the
>Fortune? 

Well, one way to do it would be to use the tr command.  For instance,
to repeat your examples:

		echo . | tr . '\007'	# 0x07
		echo . | tr . '\212'	# 0x8a

Note that tr expects to have no more than 3 digits so '\0212' won't
give you what you expect.

-- 
Jim Knutson
knutson at mcc.com
cs.utexas.edu!milano!knutson



More information about the Comp.unix.wizards mailing list