On Mon, Jun 25, 2012 at 6:35 AM, Cyrille Lefevre <
[email protected]> wrote:
> yet another portable? way :
>
> ord ()
> {
> #echo -n $(( ( 256 + $(printf '%d' "'$1"))%256 ))
> printf "%d" "'$1"
> }
> chr ()
> {
> printf \\$(($1/64*100+$1%64/8*10+$1%**8))
> }
>
> well, about ord, don't know while %d quote char works...
>
>From http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html :
If the leading character is a single-quote or double-quote,
the value shall be the numeric value in the underlying
codeset of the character following the single-quote or
double-quote.
>
> Regards,
>
> Cyrille Lefevre
> --
> mailto:Cyrille.Lefevre-lists@**laposte.net<[email protected]>
>
>
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users