I don't know if my title is clear. I explain :
I have a python script which needs 3 arguments (3 files). I need to run it three times. So, I could run the python script 3 times separately, but I want to run it only once in a nested loop.
For that, I put my necessary files in three arrays (which correspond to the three arguments). That script will create an output directory.
In my case, I will have three output directories. Each one will have the suffix of the files in the array1
, to distinguish them.
That works like that I guess, but could you see a better way to practice? Because the nested loop is pretty uncomfortable (btw, the python script gives the good directories)
for i in ${array1[@]}; do
for j in ${array2[@]}; do
for l in ${array3[@]}; do
python my_script.py $i $j $l
done
done
done
The contents of the arrays are these ones :
echo ${array1[@]}
flnc.bc1004.fq flnc.bc1005.fq flnc.bc1006.fq
echo ${array2[@]}
file_bc1004.gff file_bc1005.gff file_bc1006.gff
echo ${array3[@]}
bc1004_stats.txt bc1005_stats.txt bc1006_stats.txt
If I run the script for the files corresponding to "bc1004", it looks like :
python my_script.py flnc.bc1004.fq file_bc1004.gff bc1004_stats.txt
And I should get an output directory like my_output_dir_bc1004
Best