While I have not found a way to capture stderr and stdout to separate variables in bash, I send both to the same variable with…
result=$( { grep "JUNK" ./junk.txt; } 2>&1 )
… then I check the exit status “$?”, and act appropriately on the data in $result.