Writing for loops
From BITS wiki
Go back to parent page Introduction to Linux for bioinformatics
For loops are used to repeat commands a number of times. We will start with two simple examples.
Write a for loop to create 3 files: test1.txt, test2.txt, test3.txt |
---|
for i in 1 2 3 do touch test$i.txt done ls -l |
Write a for loop to create 3 folders: folder1, folder2, folder3 |
---|
for i in 1 2 3 do mkdir folder$i done ls -l |