I have a script that generates a .log file when the job finishes. I do not want it to move on until the number of .log files equals the number of .com files. Currently, if I execute this script it will start the loop and then immediately skip actually looping and just continue on with the script.
By what I have gleaned from reading, there is no reason this script shouldn't work. It should be caught on the loop until those two values equal to one another.
$direct is the working directory
COM="find $direct -maxdepth 1 -type f -name *.com"
log="find $direct -maxdepth 1 -type f -name *.log"
until [[ $($COM | wc -l) = $($log | wc -l) ]];
do
sleep 10
done
echo name EE E+ZPE E+U E+H G | cat > allRE
for i in R[R,S]*.out
do echo $i | cat > $i.energies &&
#cat temp.txt > $i.energies
#echo $i is finished
done
What I get is that it submits the jobs (which is coded into a part of the script not shown), starts the loop (I can see the sleep command when I look at the processes list), then tries to execute the shown part of the script only to find there are no .out files (which are created once the job has started running on the supercomputer I use), and then continues down the script.
I was asked to run it with -x. I don't know what I am looking for, so here is the section involving the loop:
++ COM='find /ddn/home6/r2536/G09Input/test2/low/com -maxdepth 1 -type f -name *.com'
++ log='find /ddn/home6/r2536/G09Input/test2/low/com -maxdepth 1 -type f -name *.log'
+++ find /ddn/home6/r2536/G09Input/test2/low/com -maxdepth 1 -type f -name RR1.com RR2.com RR3.com RR4.com RR5.com RR6.com SS1.com SS2.com SS3.com SS4.com SS5.com SS6.com
+++ wc -l
find: paths must precede expression: RR2.com
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
+++ find /ddn/home6/r2536/G09Input/test2/low/com -maxdepth 1 -type f -name '*.log'
+++ wc -l
++ [[ 0 = 0 ]] #if this is saying that there are no .com files, I don't get it, because the script just made and submitted 12 .com files.
++ echo name EE E+ZPE E+U E+H G
++ cat
++ for i in 'R[R,S]*.out'
++ echo 'R[R,S]*.out'
++ cat
++ grep 'SCF D' 'R[R,S]*.out'
++ tail -1
grep: R[R,S]*.out: No such file or directory