Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!mips!daver!kcdev!genco!rad From: rad@genco.bungi.com (Bob Daniel) Newsgroups: comp.unix.shell Subject: Re: How to convert lower case variable into upper case? Message-ID: <224@genco.bungi.com> Date: 25 Jan 91 19:26:59 GMT References: <530@twg.bc.ca> Reply-To: rad@genco.bungi.com (Bob Daniel) Organization: Gentry & Assoc. Excelsior Springs, MO Lines: 14 In article <530@twg.bc.ca> bill@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.