Bird
0
0

Find the mistake in this script snippet:

medium📝 Debug Q7 of 15
Bash Scripting - String Operations
Find the mistake in this script snippet:
text="Example"
echo ${text,}
ASingle comma converts all to lowercase, so no mistake
BVariable text is not defined
CMissing quotes around variable
DIncorrect syntax, single comma only lowercases first char
Step-by-Step Solution
Solution:
  1. Step 1: Understand single comma usage

    In bash, ${variable,} converts only the first character to lowercase.
  2. Step 2: Identify mistake

    Script uses single comma but expects all lowercase. Single comma only lowercases first char, so syntax is correct but may not meet intent.
  3. Final Answer:

    Incorrect syntax, single comma only lowercases first char -> Option D
  4. Quick Check:

    Single comma lowers first char only [OK]
Quick Trick: Single comma , lowers only first character [OK]
Common Mistakes:
MISTAKES
  • Expecting all lowercase with single comma
  • Confusing single and double commas
  • Ignoring case conversion rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes