I have been using this command successfully, which changes a variable in a config file and then executes a Python script within a loop:
for((i=114;i<=255;i+=1)); do echo $i > numbers.txt; python DoMyScript.py; done
As each DoMyScript.py
instance takes about 30 seconds to run before terminating, I'd like to relegate them to the background while the next one can be spawned.
I have tried what I am familiar with, by adding in an ampersand as below:
for((i=114;i<=255;i+=1)); do echo $i > numbers.txt; python DoMyScript.py &; done
However, this results in the below error:
-bash: syntax error near unexpected token `;'
numbers.txt
containing255
. – Stéphane Chazelas Sep 20 '13 at 19:36lists
, based on my previous usage of&
limited to just appending it to commands to shush them. Time to bash my head against bash properly! – ljs.dev Sep 21 '13 at 01:24