Bashism: Convert the case of a variable

Following on with more Bash version 4 Shell coding notes, here’s a way (as always with Bash, there’s so many ways to do anything) to ensure a variable is all lowercase characters (or all uppercase):

a=Hello
echo ${a,,}
hello

You can convert to all uppercase characters with echo ${^^}

FYI,
Richard.

This entry was posted in Network Presence, Rich and tagged , . Bookmark the permalink.