getworkerid() { local i for (( i=0 ; i >= 0 ; i++ )) do if [ -z "${workers[i]}" ] then echo $i return fi done # If we reach this, we have reached the signed long limit # (2^63 - 1 = 9223372036854775807 - Got a supercomputer?) (( concurrency-- )) }