Unix Shell - translate ascii-characters

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > January 2007 > translate ascii-characters





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author translate ascii-characters
Martin Klar

2007-01-23, 1:23 pm

Hi NG,

I need a script which translates
a character, e.g. A to its ascii-value (65).
The script has to cope with A-Z.

Thank you for your answers.

Regards, Martin
Stephane CHAZELAS

2007-01-23, 1:23 pm

2007-01-23, 18:04(+01), Martin Klar:
> Hi NG,
>
> I need a script which translates
> a character, e.g. A to its ascii-value (65).
> The script has to cope with A-Z.
>
> Thank you for your answers.

[...]

printf '%d\n' "'A"

also with zsh:

print $((##A))

or:

var=A
print $((#var))

--
Stéphane
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com