Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 4 down vote accepted

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

share|improve this answer
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
You can do '--data-urlencode' option with 'param@file1.txt' semantic :). – Grzegorz Wierzowiecki Sep 19 '11 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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