cc: [email protected]
Subject: Re: RE: [ast-users] How do I have : in an egrep [...] range?
--------


> > > Is there a simple *builtin* way for the other way round, get the character
> > > from its ordinal number? I seem to recall there was, but don't remember.
> >
> > typeset -i8 c=95
> > printf "\\${c#*#}\n"
> 
> Thanks. But I fear this needs some explanation; e.g. why does changing the 
> base
> from 8 to 12 (or 10 or 2) make that fail (and even fail in different ways)?
> Why need hte base definition at all? And what's the semantics of the '\\' in
> this context;  printf --man  seems to not explain that? Mind to elaborate?
> 
> (Also still interested in the question why plain printf "%c" doesn't work for
> that purpose.)
> 
> Thanks again.
>                     

%c doesn't work because the POSIX standard states that the the c conversion
must treat the operand as a string, and not convert it to a numerical constant.
Thus
        printf "%c\n" 93
must output 9.

ANSI C strings understand octal constants, hex constants, \x..., and
unicode constants, \u.  Since the number of digits is variable \u[...]
can determine the end of the unicode character.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to