Script issue that works in Terminal

Can someone confirm this…
Router RB2011
Firmware 5.24

:local currentIP value=[:resolve local.example.net]
:local remoteIP value=[:resolve far.example.net]
/ip ipsec policy set 0 sa-src-address="$currentIP"
/ip ipsec policy set 0 sa-dst-address="$remoteIP"
/ip ipsec peer set 0 address="currentIP"

Ipsec policy works fine.

Ipsec peer does not.

So I tried changing the last line to /ip ipsec peer set 0 address=1.1.1.2

That failed.

Cut and paste that line in terminal and hit return. Works perfect. Glitch with scripts?

It is not a glitch, you can’t use console buffered numbers inside scipts.

Use find command
/ip ipsec peer set [find comment=“myPeer”] address=“currentIP”

Thanks for the help… but it did not work.

I commented the peer as you directed. Same result. Script fails at that line.
Paste that line in terminal and it works.

Is there a script debugger?