Convert String from uppercase to lowercase in Bash

In this example, we take a look at how to convert an uppercase string to lowercase using a bash script.

Example:
#!/bin/bash

upper_case_str="CODE2CARE - LINE OF CODE FOR CHANGE"
lowercase_str=$(echo "$upper_case_str" | tr '[:upper:]' '[:lower:]')

echo "Uppercase String: $upper_case_str"
echo "Lowercase String: $lowercase_str"
Output:
Uppercase String: CODE2CARE - LINE OF CODE FOR CHANGE
Lowercase String: code2care - line of code for change
Bash Convert String from Uppercase to Lowercase Example

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!