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