How to send multiline data to curl from a script?

Karl Auer kauer at biplane.com.au
Fri Sep 3 15:03:15 UTC 2021


On Fri, 2021-09-03 at 16:42 +0200, Bo Berglund wrote:
> How do I handle the line breaks in the curl call to the php script so
> that the complete message will be read by the

If you just want to spread the curl command over multiple lines neatly
instead of having it all on one really long line you can do that by
terminating partial lines with backslashes:


    curl --data "this"      \
         --data "that"      \
         --data "the other" \
         [etc]

If you mean something else, then I don't understand the question :-)

This works for any long command. It's safest to continue lines at
whitespace, otherwise you will probably not get the results you expect.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer

GPG fingerprint: 61A0 99A9 8823 3A75 871E 5D90 BADB B237 260C 9C58
Old fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170







More information about the ubuntu-users mailing list