Hello.
my ssh-exec command returns as string 1 but witch length of 3, why?
i cant easily convert to num und all if conditions fail.
anyone an idea, howto fix my issue or is this mayby a bug?
my goal is compare in the if condition or in some loops for future.
only the 2nd if is working probably, but thats not ideal soluten, just a workaround.
here my little diagnostic:
my ssh-exec command returns as string 1 but witch length of 3, why?
i cant easily convert to num und all if conditions fail.
anyone an idea, howto fix my issue or is this mayby a bug?
my goal is compare in the if condition or in some loops for future.
only the 2nd if is working probably, but thats not ideal soluten, just a workaround.
here my little diagnostic:
Code:
:set $out [:put ([/system/ssh-exec address=$remote user=$user command=("/ip/dhcp-server/lease/print count-only where mac-address=CE:D7:2C:8A:02:DB") as-value]->"output")]:if ($out=1) do={:put "yes" } else={:put "no"}:if ((:pick $out 0 1)=1) do={:put "num yes" } else={:put "num no"}:if ((:pick $out 0 1)="1") do={:put "str yes" } else={:put "str no"}:if ((:pick $out 1 2)=" ") do={:put "str space yes" } else={:put "str space no"}:if ((:pick $out 1 2)="") do={:put "str yes" } else={:put "str no"}:put "type: $[:typeof $out]":put "len: $[:len $out]":put "len: $[:len $out]":local var [:tonum $out]:put "type: $[:typeof $var]":put "len: $[:len $var]":put "pick1: $[:pick $out 0 1]":put "pick2: $[:pick $out 0 2]":put [:typeof [:pick $out 1 2]]:put "pick3: $[:pick $out 2 3]":put "pick4: $[:pick $out 3 4]":put "pick5: $[:pick $out 3 5]"
Statistics: Posted by mali2003 — Sun Mar 30, 2025 8:29 pm