expansion

Bash Uppercase first character

Bash 4.0+ case operator; converts the first character if it matches the optional pattern and can be uppercased.

Formal Syntax & Structure

bash syntaxbash
${p^pattern}

Return Value

shell expansion result

Bash 4.0+ case operator; converts the first character if it matches the optional pattern and can be uppercased.

Working Example

Example Snippetbash
p=helloprintf '%s\n' "${p^}"
Bash Reference