adding scripts from terminal

HI,

I have simple script:

:local test ("MT test :: " . ([/system identity get name]) . " :: " .([/system clock get date]) ); 
:log info $test;

Now i wont to add this script via command line:

system script add name="test" policy=read source={:local test ("MT test :: " . ([/system identity get name]) . " :: " .([/system clock ge
t date]) ); 
{... :log info $test;}

but the result in the winbox is only one line (including character enter), so the question is how to add script from command line in order to get 2 lines in winbox?

Winbox only shows scripts on one line. C’est la vie.

when i’m editing script from winbox then I can press enter and i have got new line, so the code is simple to read…

add empty script, then use ‘edit’ command =)

This solution have same problem, in winbox shows all lines in one line…

it is the problem with *nix and windows line ends, windows use NL&CR while linux uses NL only.

hence me running linux and wine to run winbox - everything is ok, while windows box have the problem

The solution is to enter a new line “\n” and a carriage return “\r” to where you want the line break. I found the order of the carriage return and newline to matter. CR must come first (eg. \r\n). This is on ROS v5.20.

Example

/system script add name=UpdateNTPServers policy=ftp,
read,write,policy,test,winbox,api source="/system ntp client set primary-
ntp=[:resolve 0.north-america.pool.ntp.org]\r\n/system ntp client set sec
ondary-ntp=[:resolve time.nist.gov]"

When I had \n\r, it entered as one line. When I reversed to \r\n, as above, it shows up in Winbox on two lines, as expected.