How to convert lower case variable into upper case?
q.p.liu
qpliu at phoenix.princeton.edu
Thu Jan 24 15:05:59 AEST 1991
In article <530 at twg.bc.ca> bill at twg.bc.ca (bill) writes:
>My kludge at this stage is:
>case $Port in
> i1o) real_port=i1O;;
> i1p) real_port=i1P;;
>esac
>I would love to be able to do something as simple as:
>case $Port in
> i1[a-z]) real_port=i1[A-Z];;
>esac
>but I doubt life would be that kind to me. Any ideas?
If you don't mind lots of processes,
real_port=i1`echo $Port | cut -c3- | tr a-z A-Z`
or maybe,
real_port=`echo $Port | cut -c-2``echo $Port | cut -c3- | tr a-z A-Z`
More information about the Comp.unix.shell
mailing list