How to convert lower case variable into upper case?

Bob Daniel rad at genco.bungi.com
Sat Jan 26 06:26:59 AEST 1991


In article <530 at twg.bc.ca> bill at twg.bc.ca (bill) writes:
>Is  there any way, when you have something like Port=ttyi1p, that
>you  can  map lower case letters in the variable value  to  upper
>case?   If it can be done, the next step would be to prevent  the
>"i" from getting mapped and only map the last letter (p) to upper
>case (P).
>
>case $Port in
>        i1[a-z])        real_port=i1[A-Z];;
>esac
>

You can extract the third letter in Port and then pipe it to 'tr [a-z] [A-Z]'
to convert it to upper case.



More information about the Comp.unix.shell mailing list