I am trying to write a script that runs another script consecutively and records the PID of the called script each time it runs in an array.
I put in an echo statement to check the PID, when the script runs no PID is output, and the array seems to be empty. I assume it is problem with my code, but kind of stuck as to where.
i=0
while [ $i -lt 5 ]
do
./script
array[$i]=$!
echo $! #there to test that the PID exists
let i=i+1
done