So I have an until loop and then I once the conditions of the until loop is satisfied I want the loop to stop and continue down the command line. I submit a handful of jobs using PBS (also written into the script). The .com files are the input and the .log are the output. Currently, it seems that there is something problematic with calling the number of each files equal to one another and thus ending the loop.
$direct is set to the working directory
I know this from several observations:
1) The sleep process is still running when I check it on the supercomputer
2) All of the jobs have finished when I check the queue
3) Further on in the script I ask it to send an email and this doesn't happen
This is my first time working with an until loop and the sleep command, so I am wondering if I got something wrong in the syntax. If I can't solve this until loop, I could theoretically do the same thing with an if/then loop, but from what I've looked at, the until loop should be more efficient.
This is the sliver of the code I am writing that is causing me problems. The completion of the jobs to generate the .log files can take over an hour, so I don't need a short sleep time.
COM=$(find $direct -maxdepth 1 -type f -name "*.com" -printf x | wc -c)
log=$(find $direct -maxdepth 1 -type f -name "*.log" -printf x | wc -c)
until [[ $COM = $log ]];
do
sleep 10 #wait 10 seconds between checking values
done
pattern="*.out"
files=( $pattern )
grep "Isotropic" "${files[0]}" |tr -s ' ' | cut -d " " -f2 > 001.anmr
grep "Isotropic" "${files[0]}" |tr -s ' ' | cut -d " " -f3 > 000.anmr