blob: 35f52a2130303a3af2bcecbc2443189cf221a8e6 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001Long: output
2Arg: <file>
3Short: o
4Help: Write to file instead of stdout
5See-also: remote-name remote-name-all remote-header-name
6---
7Write output to <file> instead of stdout. If you are using {} or [] to fetch
8multiple documents, you can use '#' followed by a number in the <file>
9specifier. That variable will be replaced with the current string for the URL
10being fetched. Like in:
11
12 curl http://{one,two}.example.com -o "file_#1.txt"
13
14or use several variables like:
15
16 curl http://{site,host}.host[1-5].com -o "#1_#2"
17
18You may use this option as many times as the number of URLs you have. For
19example, if you specify two URLs on the same command line, you can use it like
20this:
21
22 curl -o aa example.com -o bb example.net
23
24and the order of the -o options and the URLs doesn't matter, just that the
25first -o is for the first URL and so on, so the above command line can also be
26written as
27
28 curl example.com example.net -o aa -o bb
29
30See also the --create-dirs option to create the local directories
31dynamically. Specifying the output as '-' (a single dash) will force the
32output to be done to stdout.