Trouble looping commands

Hi,

I have encountered a problem that I am unable to find a workaround for. I have 52 numbers and I need to submit an individual job for each pair combination, so too many to do by hand.

I have created a submission file (submission_code.sh) which contains the following code:

gcta64 --reml-bivar $a $b --out out_$a_$b; sleep 1

And I have created a loop file which contains the following code:

for a in `seq 1 52`
 do
  for b in `seq 1 52`
   do
  echo $a $b
  bash submission_code.sh
 sleep 1
done
done

The code runs, but it does not pass over the sequence numbers from the loop file to the submission file. Instead for " a " and " b " that values used are 1 and 2 , which are the default used by the programme.

Can anyone help with this?

Either put

gcta64 --reml-bivar $a $b --out out_$a_$b; sleep 1

directly into the for loops,
or pass them like

bash submission_code.sh "$a" "$b"

and have a submission_code.sh

gcta64 --reml-bivar "$1" "$2" --out out_"$1"_"$2"; sleep 1
1 Like

Amazing, this is great! Thank you so much for your help, I really appreciate it