Write Variable in Script

I’m trying to execute simple script, an example of which would be:

:global test [/ip dhcp-cl get [find interface=ether2] comment];
:log info $test

I can get the individual lines to work in a command console. But they don’t work when run from the script.
What am I missing?
Thanks,

is working for me.

what is your version?
try this in a console and check the output:

/system script run nameofscript

V5.25

When I run it with your Command line it does work. It thought I was going crazy.. But it does not working when you click the Run Script button.

What permissions do you have set on the script?