I have a bash script that looks like the following:##script#!/bin/bashrm data*rm logfile*for i in {1..30}do## append a & if you want to run it parallel;nohup Rscript --vanilla main.R 10 100 $i &> logfile$i &doneI would like to create another for loop after the first one to continue for another 30. For example##script#!/bin/bashrm data*rm logfile*for i in {1..30}do## append a & if you want to run it parallel;nohup Rscript --vanilla main.R 10 100 $i &> logfile$i &for i in {31..60}do## append a & if you want to run it parallel;nohup Rscript --vanilla main.R 10 100 $i &> logfile$i &doneI would like for the first set of jobs to finish before starting the new set. But because of the nohup it seems that they are all run simultaneously. I have nohup because I remotely login to my server and start the jobs there and then close my bash. Is there an alternative solution?
pausing a bash script until previous commands are finished
bash