interface ethernet switch find

There is code which works fine on most routers except for the CRS. Tell me how to adapt it to CRS ?

:foreach s in=[/interface ethernet switch find] do={:put [/interface ethernet switch get $s value-name=name];}

I understand that different chips, but how to make the universal code?

I’m not too much into scripting, but have a tip: look at the default config script to see how things are done on the CRS, it may contain useful commands for you by comparing them to your scripts.

/system default-configuration print

config default is too simple does not solve the problem
I used another solution via /interface ethernet find & /interface ethernet get $p switch

I didn’t mean to use the default configuration script, but to actually look at how it manages interfaces on the CRS and extrapolate that to cover your needs.