>>>>> On Sat, 3 Aug 2013, Michał Górny wrote:

> 2. The eclass comes with a pure bash-3.2 CamelCase converter for
> changing PNs like 'twisted-foo' into 'TwistedFoo'. The relevant code
> can be moved to eutils as portable replacements for bash-4 ${foo^}
> and friends.

>               # obtain octal ASCII code for the first letter.
>               local ord=$(printf '%o' "'${fl}")
>
>               # check if it's [a-z]. ASCII codes are locale-safe.
>               if [[ ${ord} -ge 141 && ${ord} -le 172 ]]; then
>                       # now substract 040 to make it upper-case.
>                       # fun fact: in range 0141..0172, decimal '- 40' is fine.
>                       local ord=$(( ${ord} - 40))
>                       # and convert it back to the character.
>                       fl=$(printf '\'${ord})
>               fi

This looks just horrible. You do decimal arithmetic on octal numbers?

Ulrich

Reply via email to