Programming Tips - bash: How can I change uppercase to lowercase in a bash script.

Date: 2016may1 Language: bash Q. bash: How can I change uppercase to lowercase in a bash script. A. If you have bash4+
myvar="${myvar,,}"
Otherwise, use the tr (translate) command:
tr '[:upper:]' '[:lower:]' <filein >fileout
The older style (that still works):
tr '[A-Z]' '[a-z]' <filein >fileout
This is slightly shorted but not quite as clear. To make the contents of a bash variable lowercase:
myvar=$(echo $myvar | tr '[:upper:]' '[:lower:]')