• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

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