I have two sets of directories. In the first directory, I have 8 files as such:
file1.txt file2.txt file3.txt ... file8.txt
In the second directory called output, I have multiple subdirectories. I want to write for loop that goes into each sub-directory inside output (so they are directory1, directory2 etc...) and reads a file called database_file_#.txt. Currently, I have written this loop below, but it only works for one directory at a time.
for file in *; do
name="${file%%.*}"
python script.py --parameter $file --out ../../output/directory1/${cts_name}
--readin ../../output/directory1/database_file_1.txt
done
For the second directory, I do the following:
for file in *; do
name="${file%%.*}"
python script.py --parameter $file --out ../../output/directory1/${cts_name}
--readin ../../output/directory2/database_file_2.txt
done
I do not want to keep re-writing directory# for all the directories inside output. Is there a way I can use a variable instead?