Community discussions

MikroTik App
 
faradaychong
just joined
Topic Author
Posts: 9
Joined: Fri Aug 20, 2004 4:16 am

!= Bug?

Tue Oct 04, 2005 9:22 am

[admin@MikroTik] > /user print
Flags: X - disabled
# NAME GROUP ADDRESS
0 ;;; system default user
admin full 0.0.0.0/0
1 user1 full 0.0.0.0/0
2 user2 full 0.0.0.0/0

[admin@MikroTik] > :foreach i in=[/user find comment=""] do=[:put [/user get $i name]]
user1
user2
[admin@MikroTik] > :foreach i in=[/user find comment!=""] do=[:put [/user get $i name]]
no such argument (comment!)
[admin@MikroTik] >

Above is output from 2.9.5 x86 and mips.

Anyone know how to correctly do compare unequal?
 
edzix
Member
Member
Posts: 333
Joined: Thu Jul 01, 2004 3:01 pm
Location: Latvia

Tue Oct 04, 2005 5:56 pm

maybe try to left one space between 'comment' and "!=".

Edgars
 
faradaychong
just joined
Topic Author
Posts: 9
Joined: Fri Aug 20, 2004 4:16 am

Tue Oct 04, 2005 7:17 pm

tried

:foreach i in=[/user find comment !=""] ...
:foreach i in=[/user find comment != ""] ...
:foreach i in=[/user find comment \!= ""] ...

all errored with

no such argument (=)
 
User avatar
lastguru
Member
Member
Posts: 432
Joined: Fri May 28, 2004 9:04 pm
Location: Certified Trainer/Consultant in Riga, Latvia
Contact:

Tue Oct 04, 2005 7:54 pm

find command may only check equasions (i.e., whether the value of the given property is equal to something). please use something like that:
:foreach i in=[/interface find] do={:if ([/interface get $i type] != "ether") do={ :put $i}}
 
faradaychong
just joined
Topic Author
Posts: 9
Joined: Fri Aug 20, 2004 4:16 am

Tue Oct 04, 2005 8:22 pm

thank you for the last reply, confirmed the following works:

:foreach i in=[/user find] do={:if ([/user get $i comment]!="") do=[:put [/user get $i name]]}

Who is online

Users browsing this forum: Semrush [Bot] and 68 guests