curl only write to file if successful status 200

Revision history
Tags: curl

Make curl get the contents of a URL and write to file, but only write to file if the response is successful:

curl -s -S -f -o facebook-feed.json "$facebook"

If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.