Bird
0
0

Why does the brace expansion {1..10} work in Bash for loops but not in all shells?

hard🧠 Conceptual Q10 of 15
Bash Scripting - Loops
Why does the brace expansion {1..10} work in Bash for loops but not in all shells?
ABrace expansion only works with arrays
BAll shells support brace expansion identically
CBrace expansion requires external commands
DBrace expansion is a Bash feature, not POSIX standard
Step-by-Step Solution
Solution:
  1. Step 1: Understand shell compatibility

    Bash supports brace expansion as a built-in feature; other shells may not.
  2. Step 2: Recognize POSIX standards

    Brace expansion is not part of POSIX shell standard, so not guaranteed in all shells.
  3. Final Answer:

    Brace expansion is a Bash feature, not POSIX standard -> Option D
  4. Quick Check:

    Brace expansion = Bash-specific feature [OK]
Quick Trick: Brace expansion is Bash-only, not universal shell syntax [OK]
Common Mistakes:
MISTAKES
  • Assuming all shells support brace expansion
  • Thinking brace expansion needs external tools
  • Confusing brace expansion with arrays

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes