I'm trying to get PID of command executed inside EOF block.
$ bash << EOF
> sleep 10 &
> pid1=$!
>
> sleep 10 &
> pid2=$!
>
> echo "ID1: $pid1 --- ID2: $pid2"
> EOF
In this case variables with pids are empty.
ID1:  --- ID2: 
Is there a way to get pids for such scenario?
 
     
    