Challenge - 5 Problems
Uppercase & Lowercase Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this Bash command?
Consider the following command that converts a string to uppercase. What will it output?
Bash Scripting
echo "hello World" | tr '[:lower:]' '[:upper:]'
Attempts:
2 left
💡 Hint
The tr command replaces characters from one set to another.
✗ Incorrect
The tr command with '[:lower:]' and '[:upper:]' converts all lowercase letters to uppercase. So 'hello World' becomes 'HELLO WORLD'.
💻 Command Output
intermediate1:30remaining
What is the output of this Bash command?
What will this command output when converting a string to lowercase?
Bash Scripting
echo "BASH SCRIPTING" | tr '[:upper:]' '[:lower:]'
Attempts:
2 left
💡 Hint
The tr command changes uppercase letters to lowercase letters.
✗ Incorrect
The tr command replaces all uppercase letters with lowercase letters, so 'BASH SCRIPTING' becomes 'bash scripting'.
📝 Syntax
advanced2:00remaining
Which option correctly converts a variable to uppercase in Bash?
Given a variable name VAR="hello", which command correctly converts its value to uppercase?
Bash Scripting
VAR="hello"Attempts:
2 left
💡 Hint
Use Bash parameter expansion for case conversion.
✗ Incorrect
In Bash 4+, ${VAR^^} converts all characters in VAR to uppercase. Other options are invalid syntax.
💻 Command Output
advanced2:00remaining
What is the output of this Bash script snippet?
What will this script output?
Bash Scripting
input="HeLLo WoRLd" echo "$input" | awk '{print tolower($0)}'
Attempts:
2 left
💡 Hint
awk's tolower function converts text to lowercase.
✗ Incorrect
The awk command with tolower converts the entire input string to lowercase, so output is 'hello world'.
🚀 Application
expert2:30remaining
How many lines will be printed by this script?
This script reads lines from a file and prints only those lines that are uppercase. How many lines will it print?
Bash Scripting
while IFS= read -r line; do if [[ "$line" == "${line^^}" ]]; then echo "$line" fi done < input.txt
Attempts:
2 left
💡 Hint
The condition compares the line to its uppercase version.
✗ Incorrect
The script prints lines where the original line equals its uppercase version, meaning the line is fully uppercase.