How to create 100 subdirectories using a Bash script?
The easiest way is probably to use brace expansion
mkdir subdirectory_{1..100}
To answer your question using your suggested for
loop - the brace expression mentioned by steeldriver works as well:
for i in {1..100}; do mkdir subdirectory_$i; done
To answer your updated question:
Both - the answer by steeldriver and the one by me are both meant to be one-liners.
If you would want to use this in a Bash script, you'd probably write it like:
#!/bin/bash
for i in {1..100}
do
mkdir subdirectory_$i
done
To add a little something to the truly impressive answer given by steeldriver:
You can create directories that sort "properly" by padding with zero.
mkdir subdirectory_{001..100}
(If you like this answer, please upvote steeldriver's answer. I cannot yet comment, or would have done so.)