Bird
0
0

Why does the expression ${var^^} convert all letters to uppercase in bash?

hard🧠 Conceptual Q10 of 15
Bash Scripting - String Operations
Why does the expression ${var^^} convert all letters to uppercase in bash?
ABecause ^^ is a shell variable storing uppercase letters
BBecause ^^ is a regex pattern matching uppercase letters
CBecause ^^ is a command to run uppercase function
DBecause ^^ is the parameter expansion operator for uppercase conversion
Step-by-Step Solution
Solution:
  1. Step 1: Understand bash parameter expansion

    Bash uses parameter expansion with special operators to modify variable values.
  2. Step 2: Identify role of ^^

    The ^^ operator in ${var^^} tells bash to convert all characters in var to uppercase.
  3. Final Answer:

    Because ^^ is the parameter expansion operator for uppercase conversion -> Option D
  4. Quick Check:

    ^^ is bash operator for uppercase conversion [OK]
Quick Trick: ^^ is bash's uppercase conversion operator [OK]
Common Mistakes:
MISTAKES
  • Thinking ^^ is regex or command
  • Confusing ^^ with variable
  • Not knowing parameter expansion operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes