![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2006
Posts: 5
Rep Power: 0
![]() |
Translating upper and lowercase
Hey there I was wondering how to make it so that whenever someone enters a variable that i can have that variable universal so I dont have to worry about "RANDOM" or "random" being entered and they're both read the same way.
I remember seeing a simple tr [:upper:] [:lower:] command, or something like that, but I can't find an example or explanation of the statement anywhere. Anyway, help is always appreciated. Thanks for the time spent reading this. |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
tr a-z A-Z, without the classes. Standard input to standard output, so sandwich it in there.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
On a POSIX-compliant unix, tr supports POSIX classes -- those [:upper:] things.
echo "enter a word \c" read aword aword=`echo "$aword" | tr -s '[:lower:]' '[:upper:]'` |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|