• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Passing Argument with new line

B

bdemidde

Guest
Hello,

I would like to use autoresponder.sh to setup autoresponsders...
For this I need to pass string arguments.

My question is:

How can I pass "new lines" inside a string.

/usr/local/psa/bin/autoresponder.sh -c mailname -mail mail@domain -status true -subject "Out Office - RE:<incoming_message_subject>" -text "This should be \n a multiline \n message"

Though this doesn't work as this stores "This should be n a multiline n message"...

Any idea to pass new lines arguments?

Many thanks in advance.

Benoit
 
Originally posted by bdemidde

/usr/local/psa/bin/autoresponder.sh -c mailname -mail mail@domain -status true -subject "Out Office - RE:<incoming_message_subject>" -text "This should be \n a multiline \n message"
what if you try with \r\n ?

-sh-3.1$ echo -e "one \r\ntwo"
one
two

Kind regards
Rico
 
Hi Rico,

First of all, thanks for your suggestion.

This works indeed with the echo command, but I don't see how I can force evaluation of the expression for passing it to autoresponder.sh.

Any suggestion is welcome :)

Benoit
 
Originally posted by bdemidde
I don't see how I can force evaluation of the expression for passing it to autoresponder.sh.[/B]

this is just a try, can't test it since I'm not allowed to play around with the mailing stuff.. the postmaster will screw me ;)

You'll laugh :D

echo -e "/usr/local/psa/bin/autoresponder.sh -c mailname -mail mail@domain -status true -subject "Out Office - RE:<incoming_message_subject>" -text "This should be \r\n a multiline \r\n message"" | /bin/bash

the " doesn't need to be escaped I think... but if it doesn't work with \r\n directly.. this might also not work.. if it doesn't.. I have no clue how it expects the newline... maybe:


/usr/local/psa/bin/autoresponder.sh -c mailname -mail mail@domain -status true -subject "Out Office - RE:<incoming_message_subject>" -text "This should be <br /> a multiline <br /> message"

mmh just a guess...

Kind regards
Rico
 
Rico,

Well done !!!

The first solution works like a charm.

The second one (with <br>) was not really an option to my eyes (because using HTML format).

I just had to adapt it like this:

echo -e "/usr/local/psa/bin/autoresponder.sh -c mailname -mail mail@domain -status true -subject \"Out Of Office - RE:\\<incoming_message_subject\\>\" -text \"This should be \r\n a multiline \r\n message\""| /bin/bash

Many thanks for your tips!

Best regards,

Benoit
 
Back
Top