Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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.