I'm probably too deep in the weeds and am missing something obvious here, but I'm running a script to determine the current outbound interface and can't get the find command to pull data from a variable.
/ip route \
:local immediateGateway [get [find where 8.8.8.8 in dst-address and active and routing-table=main] value-name=immediate-gw] \
:put $immediateGateway \
:put ("Raw: ". [:pick $immediateGateway ([:find $immediateGateway "%" -1] + 1) 64]) \
:put ("Quoted: ".[:pick "$immediateGateway" ([:find "$immediateGateway" "%" -1] + 1) 64]) \
:put ("Value: ".[:pick "203.0. 113.1%interfaceWan1" ([:find "203.0. 113.1%interfaceWan1" "%" -1] + 1) 64])
Output Is as follows.
203.0. 113.1%interfaceWan1
Raw:
Quoted:
Value: interfaceWan1
So... the immediateGateway local variable gets assigned, but I can't get the pick/find to pull from the value. I've tried putting the variable in raw, putting it in quoted, and doing the pick/find with the actual value itself. Doing the pick/find seems to work with the value of the variable, but I'm having no luck with getting find command to pick up the variable itself.
Thoughts?