How to convert lower case variable into upper case?
Bill Irwin
bill at twg.bc.ca
Sat Jan 26 19:14:58 AEST 1991
I asked for a way to convert the name of a uucp lock file into
its upper case counterpart /dev device name. Since you don't
know which modem ports might be in use, those solutions that had
a particular letter "wired" in have limited value.
I received several mailed responses. The simplest and most
easily understandable (by me), provided by Stuart Hood, follows:
case $modem in
i[1-9][a-z])
real_modem=i`echo $modem | sed 's/i//' | tr '[a-z]' '[A-Z]'`
;;
esac
--
S I E M E N S Stuart Hood 65-73 Crockhamwell Road, Woodley, Berkshire, UK
------------- Phone: + 44-734-691994 Email: stuart at siesoft.co.uk
N I X D O R F The trouble with everyone, is that they generalise too much
I decided to tune it a little bit because when another Digiboard
is added, the ports names are "ttyi2x". I would like the script
to handle all ports regardless of board number.
This is clean and elegant. You (Net) have probably saved me
hours of reading about sed in the manual, and I may never have
stumbled across tr. Now that I know what these utilities can do,
the next time I have a similar problem I can research it in the
manual.
I think the Net is wonderful for these types of things. Thanks
to all who responded.
--
Bill Irwin - The Westrheim Group - Vancouver, BC, Canada
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uunet!van-bc!twg!bill (604) 431-9600 (voice) | Your Computer
bill at twg.bc.ca (604) 430-4329 (fax) | Systems Partner
More information about the Comp.unix.shell
mailing list