Challenge - 5 Problems
Brace Expansion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:00remaining
Output of simple brace expansion
What is the output of the following bash command?
echo {1..5}Bash Scripting
echo {1..5}Attempts:
2 left
💡 Hint
Brace expansion generates a sequence of numbers separated by spaces.
✗ Incorrect
The brace expansion {1..5} generates numbers from 1 to 5 separated by spaces when echoed.
💻 Command Output
intermediate1:00remaining
Brace expansion with step value
What is the output of this bash command?
echo {1..10..3}Bash Scripting
echo {1..10..3}Attempts:
2 left
💡 Hint
The third number in brace expansion is the step size.
✗ Incorrect
The sequence starts at 1, increments by 3, and stops at or before 10: 1,4,7,10.
📝 Syntax
advanced1:30remaining
Identify invalid brace expansion syntax
Which of the following is NOT a valid brace expansion in bash?
Attempts:
2 left
💡 Hint
Step value cannot be zero in brace expansion.
✗ Incorrect
A step value of zero is invalid and causes an error in bash brace expansion.
💻 Command Output
advanced1:30remaining
Output of nested brace expansion
What is the output of this bash command?
echo file{1..3}_{a..b}.txtBash Scripting
echo file{1..3}_{a..b}.txtAttempts:
2 left
💡 Hint
Brace expansions combine all possible pairs from each set.
✗ Incorrect
The command expands numbers 1 to 3 and letters a to b, combining each number with each letter.
🚀 Application
expert2:00remaining
Count files created by brace expansion
If you run this command:
How many files will be created?
touch log_{01..10}_{a..c}.txtHow many files will be created?
Bash Scripting
touch log_{01..10}_{a..c}.txtAttempts:
2 left
💡 Hint
Multiply the count of numbers by the count of letters.
✗ Incorrect
There are 10 numbers (01 to 10) and 3 letters (a to c), so 10 * 3 = 30 files.