Community discussions

MikroTik App
 
PackElend
Member Candidate
Member Candidate
Topic Author
Posts: 269
Joined: Tue Sep 29, 2020 6:05 pm

how to escape quotes in parse to quote variable name?

Wed Mar 30, 2022 2:03 pm

Hello,
I would like to achieve
[admin@MikroTik] > :global "vlan_common" {id=100; name="VLAN_COMMON" ;  comment="COMMON SERVICES AND DEVICES / OFFICE"      }
[admin@MikroTik] > :put ($"vlan_common")
comment=COMMON SERVICES AND DEVICES / OFFICE;id=100;name=VLAN_COMMON
[admin@MikroTik] > :put ($"vlan_common"->"name")
VLAN_COMMON
[admin@MikroTik] > :put ([ :toarray "UP, vlan_common ,KIDS" ]->1)
vlan_common 
[admin@MikroTik] > :put (:parse "\$\"([ :toarray "UP, vlan_common ,KIDS" ]\"->1)"->"name")
VLAN_COMMON 
but the last command gives an empty value.
Even a simple version gives only an empty value or just string:
[admin@MikroTik] > :put (  (:parse "\$\"vlan_common\" ") -> "name"  ) 

[admin@MikroTik] > :put (  :parse "\$\"vlan_common\" " ) 
$"vlan_common" 
any idea how to make it work?

Who is online

Users browsing this forum: No registered users and 15 guests