Bird
0
0

Which of the following commands correctly uses brace expansion to create files named file1.txt to file10.txt?

easy🧠 Conceptual Q2 of 15
Bash Scripting - Quoting and Expansion
Which of the following commands correctly uses brace expansion to create files named file1.txt to file10.txt?
Atouch file{1,10}.txt
Btouch file{1-10}.txt
Ctouch file{1..10}.txt
Dtouch file{1..10.txt}
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct brace expansion syntax

    The correct syntax for a sequence is {start..end}, so {1..10} is valid.
  2. Step 2: Check command correctness

    touch file{1..10}.txt creates files file1.txt to file10.txt as expected.
  3. Final Answer:

    touch file{1..10}.txt -> Option C
  4. Quick Check:

    Correct brace syntax = touch file{1..10}.txt [OK]
Quick Trick: Use {start..end} for sequences, commas list specific items [OK]
Common Mistakes:
MISTAKES
  • Using commas instead of two dots for ranges
  • Including file extension inside braces incorrectly
  • Using hyphens instead of two dots

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes