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
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap