Community discussions

MikroTik App
 
antiqued4
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 75
Joined: Mon Jan 13, 2020 1:50 pm

Help with quotes and variables

Mon Jun 20, 2022 5:40 pm

Hi guys, someone who understands script there if you can help me, I need to run a script that contains quotes within variables.

if I leave it in this format, it gives an error in the first quote
\n/tool ​​e-mail send body="$linkname is online subject=Test to=demailtest@test.com\r\

Now if I do it this way:
\n/tool ​​e-mail send body=\"$linkname is online" subject=Test to=demailtest@teste.com\r\
It gives Error in the first s there of the subject

If I leave it in this format below, it adds the variable and the text, but without the quotes it doesn't work
\n/tool ​​e-mail send body=\$linkname is online subject=Test to=demailtest@test.com\r\

I would need to add both the variable and the text but everything in quotes, does anyone know how? would have to stay like this
/tool ​​e-mail send body="$linkname is online" subject=Test to=demailtest@test.com
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Help with quotes and variables

Mon Jun 20, 2022 6:36 pm

 
antiqued4
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 75
Joined: Mon Jan 13, 2020 1:50 pm

Re: Help with quotes and variables

Mon Jun 20, 2022 7:20 pm

I tried it in several ways unfortunately or it emits the variable, or the variable already comes with a value
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Help with quotes and variables  [SOLVED]

Mon Jun 20, 2022 7:57 pm

"some string and \"string withing string $variable continued\" end"
 
antiqued4
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 75
Joined: Mon Jan 13, 2020 1:50 pm

Re: Help with quotes and variables

Mon Jun 20, 2022 8:15 pm

"some string and \"string withing string $variable continued\" end"
I got it, thanks a lot, here's an example below of how I did it in case it helps someone

body=\"\$string is online\"

Who is online

Users browsing this forum: No registered users and 17 guests