Command result

Hello,

I need help for my script, i try to get a gateway with the command “find”.
I have two routes with the same comment and the script get two id “*1,*2”.
But i just need to get just the first id.

Command = :put [get [find comment=ISP1] gateway]
Result = invalid internal item number

Command = :put [find comment=ISP1]
Result = **3;1

Thanks you.

foreach i in=[/ip route get [find comment=ISP1] gateway]] do={:put $i}

Sorry but it does not work.

Command in terminal : foreach i in=[/ip route get [find comment=ISP1] gateway] do={:put $i}
Result : invalid internal item number

Use :pick to take only the first ID out of the list:

:put [get [:pick [find comment=ISP1] 0] gateway]

Thanks you, it’s work !

It’s Solved.