Setting a dialplan variable with asterisk cli output

I have also tried

exten => 7000,1,Answer()
exten => 7000,2,Set(TES=${SHELL(/etc/config/activechannels.sh)})
exten => 7000,3,Verbose(${TES})
exten => 7000,4,Hangup

activechannels.sh
asterisk -rx ‘core show channels’ | grep ‘channels’ | cut -d’ ’ -f1

and I do not get an out put to the dial plan

I think I am missing somthing simple here

It would also apear that I can recive simple text back from a command or a script like

${SHELL(echo 123):0:-1}
or
${SHELL(/test.sh):0:-1}

test.sh
echo “123”

but nothing more complicated