Works in Terminal but not in Script

Hi

I have the following problem. I can run this command succesfully in terminal, but it wont run when i put the same command in a script. It just doesnt run. I am using Ver 5.11 on a RB750GL

/ip ipsec policy set 0 sa-dst-address=$RemoteSite sa-src-address=$LocalSite

Btw, I got this from gregsowell.com

Thanks

You can only use the index numbers in the console, as they’re generate dynamically and linked to your console session. Rather than using 0 there use a [find] to get the appropriate item to be updated.