Linux creates multiple files with the same name… here is a solution to the problem.
Linux creates multiple files with the same name
I need to create 8 txt files named text[x], where X is a number from 1 to 8.
Is there a simple structure to do this? I want to use iterations.
Simple methods such as:
touch text1.txt text2.txt text3.txt text4.txt text5.txt text6.txt text7.txt text8.txt
Yes Not Acceptable.
Solution
You can do this without a loop by using brace expansion
in the filename:
touch text{1..8}.txt
See Brace Extensions
in the bash man page. Unlike wildcard extensions, curly brace extensions do not require a file name.