Bird
0
0

What is the output of the following Bash command?

medium📝 Command Output Q13 of 15
Bash Scripting - Quoting and Expansion
What is the output of the following Bash command?
echo file{1..3}.txt
Afile1.txt file2.txt file3.txt
Bfile{1..3}.txt
Cfile1 file2 file3.txt
Dfile1.txt file2.txt file3
Step-by-Step Solution
Solution:
  1. Step 1: Understand brace expansion with suffix

    The brace expansion {1..3} generates 1 2 3, and the suffix .txt is added to each.
  2. Step 2: Combine parts

    Each expanded number is combined with 'file' prefix and '.txt' suffix, producing: file1.txt file2.txt file3.txt.
  3. Final Answer:

    file1.txt file2.txt file3.txt -> Option A
  4. Quick Check:

    Brace expansion with suffix repeats suffix for each number [OK]
Quick Trick: Brace expansion repeats suffix/prefix for each number [OK]
Common Mistakes:
MISTAKES
  • Expecting literal braces in output
  • Missing suffix on some items
  • Mixing suffix placement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes