I want to create a shell script in debian that:
- creates a directory for each number from 1 to 12 = d1, d2, d3 , ..., d12.
- creates the same text file inside every directory
- changes a string inside the text file
- downloads files using wget
(Create d1; copy links.txt and rename to d1.txt; change every number from 0 to 99 to 1. Then for d2, rename it to d2.txt, change every number to 2 ...the same for the 12).
#!/bin/bash
START=1
END=12
for ((i=START; i<=END; i++))
do
mkdir d'$i'
cp /home/user/script/links.txt /home/user/script/d'$i'.txt
grep -rli '([0-99])' /home/user/script/d'$i'.txt | xargs -i@ sed -i 's/[0-99]/'$i'/g' @
wget -i /home/user/script/d'$i'/d'$i'.txt
done
What do I need to change to make it work?