Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to convert the variable 'text' to uppercase using parameter expansion.
Bash Scripting
echo "$[1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single caret (^) converts only the first character.
Using double commas (,,) converts to lowercase instead.
Adding extra commas or carets causes syntax errors.
✗ Incorrect
Using '${text^^}' converts all characters in 'text' to uppercase in bash parameter expansion.
2fill in blank
mediumComplete the code to convert the variable 'text' to lowercase using parameter expansion.
Bash Scripting
echo "$[1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double carets (^^) converts to uppercase instead.
Using single caret (^) converts only the first character.
Adding extra commas causes syntax errors.
✗ Incorrect
Using '${text,,}' converts all characters in 'text' to lowercase in bash parameter expansion.
3fill in blank
hardFix the error in the code to convert only the first character of 'text' to uppercase.
Bash Scripting
echo "$[1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double carets (^^) converts all letters, not just the first.
Using double commas (,,) converts to lowercase.
Using a comma alone is invalid syntax.
✗ Incorrect
Using '${text^}' converts only the first character of 'text' to uppercase in bash parameter expansion.
4fill in blank
hardFill both blanks to convert the variable 'word' to lowercase and then print it.
Bash Scripting
lowercase_word="$[1]" echo "$[2]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase conversion instead of lowercase.
Printing the original variable instead of the lowercase one.
Mixing variable names causing undefined variable errors.
✗ Incorrect
First, '${word,,}' converts 'word' to lowercase and stores it in 'lowercase_word'. Then, 'echo ${lowercase_word}' prints it.
5fill in blank
hardFill all three blanks to create a script that reads input into 'input_text', converts it to uppercase, and prints it.
Bash Scripting
read -p "Enter text: " [1] uppercase_text="$[2]" echo "$[3]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase conversion instead of uppercase.
Printing the original input variable instead of the uppercase one.
Forgetting to assign the read input to a variable.
✗ Incorrect
The script reads user input into 'input_text', converts it to uppercase with '${input_text^^}', stores in 'uppercase_text', then prints it.