tags:

views:

20

answers:

1

I've tried the following to send a line break with curl, but \n is not interpreted by curl.

curl -X PUT -d "my message\n" http://localhost:8000/hello

How can I send a line break with curl?

+2  A: 

Not an answer to your question, but I would work around it by creating a temporary file containing the message and line break, and give curl that file to work on:

curl -X PUT -d @message.txt http://localhost:8000/hello

From the manual:

If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with --data @foobar.

Pekka