In this command:

curl -d param1=value1 -d param2=value2 http://example.com/submit

If value1 is located in file1.txt, how can I make cURL include file1.txt in the command?


Something like this should do the trick: curl -d param="$(cat file1.txt)" ...

  • 2
    You can also do $(< file1.txt) and avoid using cat. – Reid Jul 25 '11 at 16:02
  • Right. I just love cats :) – alex Jul 25 '11 at 18:02
  • 2
    You can do '--data-urlencode' option with 'param@file1.txt' semantic :). – Grzegorz Wierzowiecki Sep 19 '11 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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