Bird
0
0

In bash, which syntax will convert the variable data to uppercase letters?

easy🧠 Conceptual Q1 of 15
Bash Scripting - String Operations
In bash, which syntax will convert the variable data to uppercase letters?
Aecho ${data,,}
Becho ${data^^}
Cecho ${data^}
Decho ${data,}
Step-by-Step Solution
Solution:
  1. Step 1: Identify uppercase conversion syntax

    In bash, ${variable^^} converts all characters to uppercase.
  2. Step 2: Check other options

    ${data,,} converts to lowercase, ${data^} capitalizes only first character, ${data,} lowercases first character.
  3. Final Answer:

    echo ${data^^} -> Option B
  4. Quick Check:

    Uppercase all letters uses double caret [OK]
Quick Trick: Use double caret ^^ for uppercase conversion [OK]
Common Mistakes:
MISTAKES
  • Using single caret ^ converts only first letter
  • Confusing lowercase and uppercase syntax
  • Using commas instead of carets

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes