case modification
The ${name^^} and ${name,,} forms, which convert a value to upper or lower case; a single caret or comma changes only the first letter.
In more detail
It arrived in bash 4, so it fails on the bash 3.2 that ships with macOS and in POSIX sh. Use tr for the same job in a portable script.
Example
echo "${name^^}"Related terms
- parameter expansion — Replacing a dollar sign and a variable name with the variable's value, optionally transformed by an operator inside curly braces.
- tr — The command that replaces, squeezes or deletes single characters as text passes through it.
- bashism — A bash-only feature, such as [[ ]], arrays, (( )) or process substitution, used in a script that claims to be POSIX sh.
Taught in
- Which Shell Am I In, And Getting Bash Five — Bash Scripting & Command Line Automation
- Trimming, Replacing And Changing Case — Bash Scripting & Command Line Automation
- Functions, local And declare — Bash Scripting & Command Line Automation
- POSIX sh Versus Bash — Bash Scripting & Command Line Automation