Generating Octal/Hex Codes from Bourne Shell

David Elliott dce at mips.COM
Fri Aug 19 07:03:04 AEST 1988


In article <1054 at marconi.SW.MCC.COM> knutson at marconi.sw.mcc.com.UUCP (Jim Knutson) writes:
>In article <118 at gillxp> rg at gillxp (Richard J. Gill) writes:
>>...                                           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

This is a very useful trick.

One thing it doesn't handle is generating a NUL.  I've tried all
kinds of things, but have never found a way to generate a NUL
character from a shell script.  Well, I guess C is good for at
least *one* thing ;-)

-- 
David Elliott		dce at mips.com  or  {ames,prls,pyramid,decwrl}!mips!dce



More information about the Comp.unix.wizards mailing list