Probably not an answer to this particular problem, but a side note for OP:
- You still didn't use shellcheck.net as you were previously requested to, it would have told you that e.g.:
Line 29:
if [ ! -f slurm-* ];
^-- SC2144 (error): -f doesn't work with globs. Use a for loop.
- Beware of
mv CrSBr* CrSBr-Field-Cooling.slurm;
as it would probably fail with
mv: target 'CrSBr-Field-Cooling.slurm' is not a directory
- You most likely don't need 5 nested "for loops", you'd be perfectly fine with a single one (and a correctly used "brace expansion" mechanism); and you don't need copious number of
cd
s - see my reply to your previous post.