FOR loop
by gilesaj001 from LinuxQuestions.org on (#4WNT0)
I want to create multiple folders using the for loop and I have been trying to figure it out now for a while and can't seem to get the right syntax. I want to create multiple folders in the folder i run the script in called BOINC_100 BOINC_101 BOINC_102 etc I have tried a lot of things and the only one I have gotten to run is as follows:
Code:#!/bin/bash
for x in {100..1..101}
do
mkdir "BOINC_$x"
doneBut instead of creating multiple folders it just creates one folder called BOINC_{100..101..1}
If I try for $x in {100..1..101} I get this error Syntax error: Bad for loop variable
If I try for x in [100..1..101]
I get a folder called 'BOINC_[100..1..101]'
Cheers.


Code:#!/bin/bash
for x in {100..1..101}
do
mkdir "BOINC_$x"
doneBut instead of creating multiple folders it just creates one folder called BOINC_{100..101..1}
If I try for $x in {100..1..101} I get this error Syntax error: Bad for loop variable
If I try for x in [100..1..101]
I get a folder called 'BOINC_[100..1..101]'
Cheers.