| 1 |
Long: config |
| 2 |
Arg: <file> |
| 3 |
Help: Read config from a file |
| 4 |
Short: K |
| 5 |
--- |
| 6 |
|
| 7 |
Specify a text file to read curl arguments from. The command line arguments |
| 8 |
found in the text file will be used as if they were provided on the command |
| 9 |
line. |
| 10 |
|
| 11 |
Options and their parameters must be specified on the same line in the file, |
| 12 |
separated by whitespace, colon, or the equals sign. Long option names can |
| 13 |
optionally be given in the config file without the initial double dashes and |
| 14 |
if so, the colon or equals characters can be used as separators. If the option |
| 15 |
is specified with one or two dashes, there can be no colon or equals character |
| 16 |
between the option and its parameter. |
| 17 |
|
| 18 |
If the parameter contains whitespace (or starts with : or =), the parameter |
| 19 |
must be enclosed within quotes. Within double quotes, the following escape |
| 20 |
sequences are available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash |
| 21 |
preceding any other letter is ignored. If the first column of a config line is |
| 22 |
a '#' character, the rest of the line will be treated as a comment. Only write |
| 23 |
one option per physical line in the config file. |
| 24 |
|
| 25 |
Specify the filename to --config as '-' to make curl read the file from stdin. |
| 26 |
|
| 27 |
Note that to be able to specify a URL in the config file, you need to specify |
| 28 |
it using the --url option, and not by simply writing the URL on its own |
| 29 |
line. So, it could look similar to this: |
| 30 |
|
| 31 |
url = "https://curl.haxx.se/docs/" |
| 32 |
|
| 33 |
When curl is invoked, it (unless --disable is used) checks for a default |
| 34 |
config file and uses it if found. The default config file is checked for in |
| 35 |
the following places in this order: |
| 36 |
|
| 37 |
1) curl tries to find the "home dir": It first checks for the CURL_HOME and |
| 38 |
then the HOME environment variables. Failing that, it uses getpwuid() on |
| 39 |
Unix-like systems (which returns the home dir given the current user in your |
| 40 |
system). On Windows, it then checks for the APPDATA variable, or as a last |
| 41 |
resort the '%USERPROFILE%\\Application Data'. |
| 42 |
|
| 43 |
2) On windows, if there is no .curlrc file in the home dir, it checks for one |
| 44 |
in the same dir the curl executable is placed. On Unix-like systems, it will |
| 45 |
simply try to load .curlrc from the determined home dir. |
| 46 |
|
| 47 |
.nf |
| 48 |
# --- Example file --- |
| 49 |
# this is a comment |
| 50 |
url = "example.com" |
| 51 |
output = "curlhere.html" |
| 52 |
user-agent = "superagent/1.0" |
| 53 |
|
| 54 |
# and fetch another URL too |
| 55 |
url = "example.com/docs/manpage.html" |
| 56 |
-O |
| 57 |
referer = "http://nowhereatall.example.com/" |
| 58 |
# --- End of example file --- |
| 59 |
.fi |
| 60 |
|
| 61 |
This option can be used multiple times to load multiple config files. |