output.d 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. c: Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
  2. SPDX-License-Identifier: curl
  3. Long: output
  4. Arg: <file>
  5. Short: o
  6. Help: Write to file instead of stdout
  7. See-also: remote-name remote-name-all remote-header-name
  8. Category: important curl
  9. Example: -o file $URL
  10. Example: "http://{one,two}.example.com" -o "file_#1.txt"
  11. Example: "http://{site,host}.host[1-5].com" -o "#1_#2"
  12. Example: -o file $URL -o file2 https://example.net
  13. Added: 4.0
  14. ---
  15. Write output to <file> instead of stdout. If you are using {} or [] to fetch
  16. multiple documents, you should quote the URL and you can use '#' followed by a
  17. number in the <file> specifier. That variable will be replaced with the current
  18. string for the URL being fetched. Like in:
  19. curl "http://{one,two}.example.com" -o "file_#1.txt"
  20. or use several variables like:
  21. curl "http://{site,host}.host[1-5].com" -o "#1_#2"
  22. You may use this option as many times as the number of URLs you have. For
  23. example, if you specify two URLs on the same command line, you can use it like
  24. this:
  25. curl -o aa example.com -o bb example.net
  26. and the order of the -o options and the URLs does not matter, just that the
  27. first -o is for the first URL and so on, so the above command line can also be
  28. written as
  29. curl example.com example.net -o aa -o bb
  30. See also the --create-dirs option to create the local directories
  31. dynamically. Specifying the output as '-' (a single dash) will force the
  32. output to be done to stdout.
  33. To suppress response bodies, you can redirect output to /dev/null:
  34. curl example.com -o /dev/null
  35. Or for Windows use nul:
  36. curl example.com -o nul