It seems that the variables files when there are two - (minus) in the string.
This is from my DHCP server with name "DHCP-Pool-vlan1-Home"
I would like to get the number of leases in the DHCP server, but it seems to feil due to the pool name
Running this from cli, I should get 95 for all test.
Code: Select all
[
:local orig "DHCP-Pool-vlan1-Home"
:local test1 "vlan1-Home"
:local test2 "-vlan1-Home"
:local test3 "l-vlan1-Home"
:local test4 "l-vlan1-H"
:local test5 "vlan1-H"
:put "orig=$([:len [/ip dhcp-server lease find where server~"$orig"]])"
:put "test1=$([:len [/ip dhcp-server lease find where server~$test1]])"
:put "test2=$([:len [/ip dhcp-server lease find where server~"$test2"]])"
:put "test3=$([:len [/ip dhcp-server lease find where server~"$test3"]])"
:put "test4=$([:len [/ip dhcp-server lease find where server~"$test4"]])"
:put "test5=$([:len [/ip dhcp-server lease find where server~"$test5"]])"
]
orig=0
test1=95
test2=95
test3=0
test4=0
test5=95