Community discussions

 
mpixel
newbie
Topic Author
Posts: 31
Joined: Wed Jun 24, 2009 9:58 pm

I cannot write the contents of a variable to a file. The contents of the mikrotik directory are written instead of the v

Thu Nov 07, 2019 6:18 pm

I cannot write the contents of a variable to a file. The contents of the mikrotik directory are written instead of the variable.

I cannot write $obsah to a the file
the penultimate line is still correct
:log info - show me the correct content but the last command writes a directory list to the file. Not content of variable $obsah.
:local obsah;
:local filename "test.txt";
/ip dhcp-server lease
:foreach i in=[find] do={
:set obsah ($obsah . "\n" .  [get $i host-name] . "," . [get $i address]);
}
/file print file=$filename;

# here is the right content that I need to write to a file
:log info $obsah;

# But the list of the mikrotik file directory is written to the file instead of variable     !???????
/file set $filename contents=$obsah;

Who is online

Users browsing this forum: No registered users and 8 guests