I am trying to run a shell script where it reads the variables from a txt file, uses that variable in a for loop to run python file.
The code reads a txt file where at least there are 100 variable such as var1, var2, var3....var 100
The code changes the directory (Rep1, Rep2) to read another file from each directory RepOut_Rep1.out
The code runs a python code where it takes the entries from different directories
python /home/PhytonFiles/phytonFold.py -s /home/mySFiles/$var -o $RepOut_Rep1.out -n summaryFile.txt
I wrote the following code but I am afraid it did not work
input="MyList.txt"
while IFS= read -r file;
do
# printf '%s\n' "$file"
run the script for the following directories (Rep1, Rep2. ...)
for f in Rep1 Rep2
do
cd ${f}
pull the output file
outFile=RepOut_${f}.out
create a summary folder at the end of the run
summaryFile=summary_${f}_$file
run the python file, get the inputs from /home/mySFiles/ with the variable $file
phyton /home/PhytonFiles/phytonFile.py -s /home/mySFiles/$file -o $outFile -n $summaryFile
done
done < "$input"
I am not sure if my use of variables are correct in the python run line. Where do I make mistakes?
Thank you for your help.
Bircan
phyton script.py
won’t get you very far. – doneal24 Apr 03 '23 at 02:44