7 ms·
Streaming to stdout is more Unix-y, allowing you to pipe the response into further processes. For example: curl http://api.example.com/json | jq '.["someKe
by Xophmeister 11y ago
Streaming to stdout is more Unix-y, allowing you to pipe the response into further processes. For example:
curl http://api.example.com/json | jq '.["someKey"]' # etc., etc.
- mooreds 11y agoFair enough. Perhaps I just need to adjust my expectations. Or maybe there's a good reason for having two tools :)
- koolba 11y agoOr in modern idiomatically insecure install scripts: curl http://bogus.example.com/install | sudo bash
- digi_owl 11y agoToo bad that is a reserved domain. Would be hilarious to put an actual shell script there that would echo ARF ARF ARF in a loop.
- lomnakkus 11y agoIt may be more unix-y, but it's less user-friendly if the expectation is to just download a file. EDIT: Wow, surprised by the downvotes. I don't think I said anything controversial (y'know principle of least surprise and all), but maybe I was being a bit too opaque: wget, by virtue of being the first on the scene, built an expectation that $THING_THAT_GETS_URLS would result in a file without any other input/arguments. Curl, to this day, surprises me because I was around when wget was all you had.
- ars 11y agoRemove your edit, it makes it more likely for you to get downvotes, not less. If you post something, stand by it, do not worry about downvotes. I don't really like them, but nevertheless I'm proud when I get a downvote - it means I don't have a hive-mind mentality.
- lomnakkus 11y agoNah, I don't really mind the downvotes per se. I was just surprised, that's all. Anyway, seems that my further clarification in the edit cleared up some confusion on the content of my post, so it's all good.
- vacri 11y agoNonsense. You can use both tools. 'curl' is 'cat url', and by default is meant to behave like 'cat' - that is, send stuff to STDOUT. 'wget' is 'web get', and gets an object from (only) the web or ftp, and plonks it on your filesystem. They both do exactly what they're supposed to (according to name), by default.
- lomnakkus 11y ago> 'curl' is 'cat url', Whoa... TIL something! I don't know if that's the official etymology, but that's a great mnemonic! EDIT: ... and yes, I use both tools :).
- vacri 11y agoWell, it looks like I was taught wrong, and it's not 'cat URL' (though that's a good way to think of it), but the rather more direct-to-STDOUT-sounding 'see URL'. TIL something too :) https://en.wikipedia.org/wiki/CURL https://en.wikipedia.org/wiki/CURL
- botw 11y agoMy first impression is 'cat URL' not 'see URL'. The wikipedia article does not have to be official.
- ars 11y agoOne nice thing about saving a file vs piping is that wget sets the timestamp on the file based on the remote HTTP headers. curl -o does not.
- Freaky 11y agocurl -Ro does, however.