Hello.
I am not sure how to explain this...
Below is a for loop that calls a function for loop. I am trying to somehow not wait till the function loop finishes before the next call is made.
So as soon as the doit "A" is called then doit "B" is called without waiting. Is this possible or is there a workaround for this?
The goal is to run multiple apps at once for an hour each. So I need to create a loop that will start them without waiting. Also the app have dynamic info for each so I can't make a static cron entry.
Example:
Code:
#!/bin/sh
my_array=(A B)
function doit()
{
for ((i=0;i<100;i+=1)); do
echo ${i} > /tmp/${1}
sleep 1
done
}
for ((i=0;i<${#my_array[@]};i+=1)); do
doit ${my_array[${i}]}
done
exit