0
0
Bash Scriptingscripting~15 mins

Uppercase and lowercase conversion in Bash Scripting - Mini Project: Build & Apply

Choose your learning style9 modes available
Uppercase and lowercase conversion
📖 Scenario: You work in a small office where you often receive text data in mixed cases. To keep things neat, you want to convert text to all uppercase or all lowercase.
🎯 Goal: Build a simple Bash script that converts a given string to uppercase and lowercase.
📋 What You'll Learn
Create a variable with a specific string
Create a variable to hold the uppercase version
Create a variable to hold the lowercase version
Print both uppercase and lowercase results
💡 Why This Matters
🌍 Real World
Converting text case is useful for formatting data, preparing text for case-insensitive comparisons, or cleaning up user input.
💼 Career
Many automation scripts require text normalization. Knowing how to convert case in Bash helps in writing robust shell scripts for system administration and data processing.
Progress0 / 4 steps
1
Create the original text variable
Create a variable called text and set it to the exact string "Hello World".
Bash Scripting
Need a hint?

Use text="Hello World" to create the variable.

2
Create uppercase and lowercase variables
Create a variable called upper_text that converts text to uppercase using tr. Then create a variable called lower_text that converts text to lowercase using tr.
Bash Scripting
Need a hint?

Use $(echo "$text" | tr '[:lower:]' '[:upper:]') for uppercase and similarly for lowercase.

3
Print the uppercase and lowercase variables
Use echo to print the value of upper_text and then print the value of lower_text on the next line.
Bash Scripting
Need a hint?

Use echo "$upper_text" and echo "$lower_text" to print the results.

4
Final script output
Run the script to see the uppercase and lowercase versions of the original text printed exactly as shown.
Bash Scripting
Need a hint?

Just run the script to see the output.