I am working on a script to show all active interfaces in PPTP. The script is working fine when run in mikrotik console. I want to execute this script through SSH, it gives error when executed through SSH.
:global iname;:foreach i in=[/interface find type=pptp-in] do={:set iname [interface get $i name] ;:put $iname}
It shows the last interface in the list and give the following error.
“expected end of command (line 1 column 86)”
When i run this same script in MT console, it works fine.
you probably need escape the : with backslashes. ALso, you should put any parameters in quotes, especially those with dashes in them, ie type=“pptp-in”
try this:
“:foreach i in=[/interface find type=”“pptp-in”“] do={:put [/interface get $i name];}”
Didnt test, but should be close to what you need. . .
Really no need to use :global, and i think your problem is that the ‘interface get’ requires that it is run in the root context (where as ‘/interface get’ is not)