How can I spawn a process for a particular command and while it is running capture its output?

For example I want to perform `dd` on a block and while it is doing its job and producing status message , I do something else with the output of the dd progress. I tired the script below but it never stops printing:

```
#!/bin/bash

data=$(dd if=/dev/urandom of=/dev/null bs=4096 count=32768 status=progress)&

while [ -z "$data" ]; do
 echo "waiting for data..." "${data}"
 # Do something else while $data is not returned
 sleep 0.1
done

```

I have made some progress but still not the thing I want.

```
    #! /bin/bash

    varFileDone=$(mktemp)
    varFileOutput=$(mktemp)

    dd if=/dev/urandom of=/dev/null bs=4096 \
count=32768 status=progress 2<&1 >> $varFileOutput && echo 1 > $varFileDone &
    pid=$(pidof dd)

    while [[ ! -s $varFileDone ]];
    do

    data=$(cat $varFileOutput)
    echo "----->" "$data"
    if [[ -s $data ]];
      then
        echo "we have data"
        echo $data | cut -d"," -f3
      else
        echo "no data yet!"
      fi
      sleep 0.2
    done

```