Convert string from lowercase to uppercase in a shell script

Lets use the power of Bash here, ${variable^^} (the carrot symbol, two times)

Example of changing the case from lower to upper:

[email protected]:~$ myvar=codetryout
[email protected]:~$ 
[email protected]:~$ echo $myvar 
codetryout
[email protected]:~$ 

[email protected]:~$ echo ${myvar^^}
ELIB
[email protected]:~$ 

This is very useful, for example when you want to process any user input, regardless of its case.

[email protected]:~$ read userinput
yes
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES
[email protected]:~$ read userinput
Yes
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES
[email protected]:~$ read userinput
YES
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES