Convert string from lowercase to UPPERCASE in a bash shell script

Let us use the power of Bash here, ${my_variable^^} (the carrot symbol, two times)

Example of changing the case from lower to upper:

[email protected]:~$ my_variable=codetryout
[email protected]:~$ 
[email protected]:~$ echo $my_variable
codetryout
[email protected]:~$ 
[email protected]:~$ echo ${my_variable^^}
CODETRYOUT

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

# Entering all lowercase - yes
[email protected]:~$ read userinput
yes
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES

# Entering Yes, in mixed case - Yes
[email protected]:~$ read userinput
Yes
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES

# Entering all in uppercase - YES
[email protected]:~$ read userinput
YES
[email protected]:~$ [[ ${userinput^^} == YES ]] && echo YES
YES