Command works in bash but not in nri-flex

I am executing below command from nri flex integration , It fails

Command : find /opt/test/ -type d -print0 | while read -d ‘’ -r dir; do files=("$dir"/*); printf “%5d: %s\n” “${#files[@]}” “$dir” ;done;

The same works fine in command line .

./nri-flex -verbose -pretty -config_path /etc/newrelic-infra/integrations.d/file-count-fusion.yml

DEBU[0000] Function.isAvailable: enter
DEBU[0000] Function.isAvailable: exit status: false
INFO[0000] com.newrelic.nri-flex GOARCH=amd64 GOOS=linux version=1.4.3
DEBU[0000] config: git sync configuration not set
WARN[0000] config: testing agent config, agent features will not be available
DEBU[0000] config: running async name=linuxFileCountFusion
DEBU[0000] config: processing apis apis=1 name=linuxFileCountFusion
DEBU[0000] fetch: collect data name=linuxFileCountFusion
DEBU[0000] commands: executing count=1 name=linuxFileCountFusion
DEBU[0000] command: running find /opt/test -type d -print0 | while read -d ‘’ -r dir; do files=("$dir"/*);printf “%5d :%s\n” “${#files[@]}” “$dir”; done
DEBU[0000] processor-data: running data handler name=linuxFileCountFusion
DEBU[0000] config: finished variable processing apis apis=1 name=linuxFileCountFusion
INFO[0000] flex: completed processing configs configs=1
“name”: “com.newrelic.nri-flex”,
“protocol_version”: “3”,
“integration_version”: “1.4.3”,
“data”: [
“metrics”: [
“Location”: “/opt/test”,
“event_type”: “TotalFileCountFusionConsSample”,
“fileCount”: " 3 ",
“integration_name”: “com.newrelic.nri-flex”,
“integration_version”: “1.4.3”

Error in Query Builder
find /opt/test -type d -print0 | while read -d ‘’ -r dir; do files=("$dir"/*);printf “%5d :%s\n” "${

/bin/sh: -c: line 0: unexpected EOF while looking for matching `}’ /bin/sh: -c: line 1: syntax error: unexpected end of file

Can someone please help me with this ?