Exec script puts wrong value in Influx DB

I have this little bash script:
#!/bin/bash
declare -i temp
temp=$(vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*' | sed -e 's/^[0]*//' -e 's/[0.]*$//g')
$temp > /dev/null 2>&1; echo "{ \"cpu_temp\": $temp}"

Which outputs:
{ "cpu_temp": 36}

Telegraf config:
[[inputs.exec]]
commands=["/etc/telegraf/get_temp.sh"]
timeout="10s"
interval="1m"
data_format="json"

However, telegraf puts the value 0 into the influx db. I’m asking myself, waht I’m doing wrong?

Can you run this and show the output?:

sudo -u telegraf -- telegraf --input-filter=exec --test