Even more concise:
for x in Client{1..100}; do
mkdir -p $x
touch $x/$x.txt
done
题
i have been trying to create 100 folders with the names Client numbered 1-100 e.g. (client1, client2..client100) i also want to create a text file within each folder called client follwed by the same number on the folder. I have got to this peice of coding:
mkdir -p Client{1..100} && touch Client{1..100}/Client.txt
But this command line only generates a text file called client but is not numbered. Please can you help me figure out the coding to do this.
Thank you
解决方案 2
Even more concise:
for x in Client{1..100}; do
mkdir -p $x
touch $x/$x.txt
done
其他提示
Try this:
for x in {1..100}
do
mkdir -p Client$x
touch Client$x/Client$x.txt
done
Instead of {1..100}
you can use the seq
command and get additional features. For example:
for x in `seq -w 1 100`
do
....