I'm trying to write a one-liner that uses a forloop to start multiple screen (so, parallel), where in each screen another for-loop is ran (so, sequentially).
Any help would be appreciated
My attempt is to use a for-loop that makes named screens (screen -dmS) followed by screen -x NAME -X $somecommand, where $somecommand is in itself that has for-loops in it, but it doesn't yet work fully.
I've gotten closer and closer using some posts on stack overflow, but still didn't quite get there. This is what I got so far:
for b in $(seq -s ' ' 0.000 0.005 0.020); do command="for s in {1..3}; do for h in $(seq -s ' ' 0.000 0.010 0.030); do ./MultiGene -s $s -b $b -h ${h} -m 0.0 -u 0.0 -l 0.02 -name WM ${h}_b${b} -mix -w 0.3; done; done;"; screen -dmS "b${b}"; screen -x "b${b}" -X $command; done
Now, this doesn't give me a single error, and the screens get started, but nothing is happening inside the screens. So the second bit where I use -X doesn't seem to work (although this normally gives an error?)
What I want is that the started screens actually all have started their own respective for-loop.
Cheers!
PS I know there's plenty of other ways to do this, but for now I really want to solve this puzzle ;)