Community discussions

MikroTik App
 
User avatar
armandfumal
Member Candidate
Member Candidate
Topic Author
Posts: 125
Joined: Wed Apr 25, 2012 5:50 pm
Location: Huldange,LUX
Contact:

store result in variable

Fri Mar 07, 2014 9:35 pm

Hi,
could anyone help me

:local output [/ip neighbor print count-only]

:put ("result: $output")

in this case value is stored into $output

but

:local output [/ip neighbor print]

:put ("result: $output")

not this command, the content of print is not stored into the variable?
What I'm missing ?

thanks

Armand
Armand Fumal
________________________________________________________________
MikroTik & Ubiquity
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2954
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: store result in variable

Fri Mar 07, 2014 10:03 pm

You can not storage directly print output _as file_ to variable.
Also you can not storage directly "ping" results inside a variable, except for count of positive response.

ros code

/ip neighbor print file=tmpWork;
:local output [/file get tmpWork contents];
:put ("Results: ".$output);
If you like, add Karma, please.
Last edited by rextended on Fri Mar 07, 2014 11:00 pm, edited 1 time in total.
I'm Italian, not English. Sorry for my imperfect grammar.
 
User avatar
armandfumal
Member Candidate
Member Candidate
Topic Author
Posts: 125
Joined: Wed Apr 25, 2012 5:50 pm
Location: Huldange,LUX
Contact:

Re: store result in variable

Fri Mar 07, 2014 10:53 pm

You can not storage directly print output _as file_ to variable.
Also you can not storage directly "ping" results inside a variable, except for count of positive response.

ros code

/ip neighbor print file=tmpWork;
:local output [get tmpWork contents];
:put ("Results: ".$output);
If you like, add Karma, please.
just missing the /file in line 2 before the get command

many thanks

Armand
Armand Fumal
________________________________________________________________
MikroTik & Ubiquity
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2954
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: store result in variable

Fri Mar 07, 2014 10:59 pm

You can not storage directly print output _as file_ to variable.
Also you can not storage directly "ping" results inside a variable, except for count of positive response.

ros code

/ip neighbor print file=tmpWork;
:local output [get tmpWork contents];
:put ("Results: ".$output);
If you like, add Karma, please.
just missing the /file in line 2 before the get command

many thanks

Armand
Thanks, I correct my original post.
I am working on /file folder when I try the script on my RB :lol:
I'm Italian, not English. Sorry for my imperfect grammar.

Who is online

Users browsing this forum: No registered users and 17 guests