I am looking at an example of a curl command that uses the @ symbol before the filename to post data to the server.

curl http://localhost/ --data-binary @file.txt

What does this mean? Does it insert the contents of the file into the command? Is it specific to curl?

up vote 38 down vote accepted

It is specific to curl. From man curl:

--data-binary <data>
  (HTTP) This posts data exactly as specified with no extra processing whatsoever.
  If you start the data with the letter @, the rest should be a filename.  Data is
  posted in a similar manner as --data-ascii does, except that newlines are preserved
  and conversions are never done.

  If this option is used several times, the ones following the first will append data
  as described in -d, --data.
  • 2
    I should have looked there. I was expecting it to be a shell thing though. Thanks a million. – robingrindrod Jul 14 '14 at 14:55

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.