#!/bin/shpids=()for i in {1..10}; do sleep 10 & pids+=($!)doneset | grep pidsresults=()for i in ${pids[@]}; do wait -n $i results+=($?)doneset | grep results