Chef noop inside of shell command

I want to break out of chef if a bash command returns a certain value.

execute 'noop' do   command <<-EOH     cmd_output=$  (echo "test")     if [ "$  cmd_output" == "test" ]; then        return     fi   EOH end 

I’m running into an error return: can only 'return' from a function or sourced script

What is the best way to grab the output of a bash command and then return based on that?