Found a bug when scripting SSID

Hi all,
Wondering if anyone has come across this or has a way I can navigate around it easily? I won’t bore you to tears with the full files we use but I’ve been asked to write a quick rsc file to generate a guest wireless network off the back of an existing one (the “main” router config file generates this).

It all works wonderfully aside from the last part;

#generate SSID based on existing ssid
{
:local original [/interface wireless get 0 ssid]
/interface wireless set ssid="$original-Guest" numbers=1
}

The weird part is that if I run

 /interface wireless set ssid="whatever-guest" numbers=1

In terminal, I get a response “No such item found”

The weird part is that if I then run

 /interface wireless print

then run the same command as above again, it works with no issues.

My solution currently is as follows;

{
:local original [/interface wireless get 0 ssid]
/interface wireless print
/interface wireless set ssid="$original-Guest" numbers=1
}

It just seems “dirty” to have that print in the middle though to “make” rOS see the wireless interface number 1.

Any help?

It is not a bug. You cannot use console buffered numbers to set items.
Instead you need to use internal IDs that are returned using commands like “find”.

OK, will change and re-test.

Why does it work after doing a print though?

Because when you run print command console creates and stores those numbers in the buffer.
But I would not recommend to use this method, it is not reliable since depending on how you run the print command it may return different numbers for the same item, use “find” instead.

Brill, Thank you