On Sun, 24 Jun 2012 09:33:11 +0200 Janis Papanagnou wrote:
> > From: [email protected]
> >
> > $ print $(( '_' )) $(( ':' ))
> > 95 58

> I wasn't aware that we can get the ordinal numbers of characters that way.
> Thanks!

> In cases where I am looking for the other way round, getting the character
> from its ordinal number, I intuitively always first try (though to no avail)
>   printf "%c%c\n" 95 58
> As a workaround I still resort to
>   $( echo 95P | dc )
>   $( echo 58P | dc )

> 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.
> BTW, does anybody know why a printf conversion doesn't work as one would
> expect?

posix defined %c to take the first char of the corresponding operand -- not 
very useful

this works, but I bet dgk has a better way

        printf '\x'$(printf %02x 65)'\n'

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

Reply via email to