config.d 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Long: config
  2. Arg: <file>
  3. Help: Read config from a file
  4. Short: K
  5. Category: curl
  6. Example: --config file.txt $URL
  7. Added: 4.10
  8. See-also: disable
  9. ---
  10. Specify a text file to read curl arguments from. The command line arguments
  11. found in the text file will be used as if they were provided on the command
  12. line.
  13. Options and their parameters must be specified on the same line in the file,
  14. separated by whitespace, colon, or the equals sign. Long option names can
  15. optionally be given in the config file without the initial double dashes and
  16. if so, the colon or equals characters can be used as separators. If the option
  17. is specified with one or two dashes, there can be no colon or equals character
  18. between the option and its parameter.
  19. If the parameter contains whitespace (or starts with : or =), the parameter
  20. must be enclosed within quotes. Within double quotes, the following escape
  21. sequences are available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash
  22. preceding any other letter is ignored.
  23. If the first column of a config line is a '#' character, the rest of the line
  24. will be treated as a comment.
  25. Only write one option per physical line in the config file.
  26. Specify the filename to --config as '-' to make curl read the file from stdin.
  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. url = "https://curl.se/docs/"
  31. # --- Example file ---
  32. # this is a comment
  33. url = "example.com"
  34. output = "curlhere.html"
  35. user-agent = "superagent/1.0"
  36. # and fetch another URL too
  37. url = "example.com/docs/manpage.html"
  38. -O
  39. referer = "http://nowhereatall.example.com/"
  40. # --- End of example file ---
  41. When curl is invoked, it (unless --disable is used) checks for a default
  42. config file and uses it if found, even when --config is used. The default
  43. config file is checked for in the following places in this order:
  44. 1) "$CURL_HOME/.curlrc"
  45. 2) "$XDG_CONFIG_HOME/.curlrc" (Added in 7.73.0)
  46. 3) "$HOME/.curlrc"
  47. 4) Windows: "%USERPROFILE%\\.curlrc"
  48. 5) Windows: "%APPDATA%\\.curlrc"
  49. 6) Windows: "%USERPROFILE%\\Application Data\\.curlrc"
  50. 7) Non-Windows: use getpwuid to find the home directory
  51. 8) On Windows, if it finds no .curlrc file in the sequence described above, it
  52. checks for one in the same dir the curl executable is placed.
  53. On Windows two filenames are checked per location: .curlrc and _curlrc,
  54. preferring the former. Older versions on Windows checked for _curlrc only.
  55. This option can be used multiple times to load multiple config files.