curl only write to file if successful status 200
- 18 Sep 2017: Post was created (diff)
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"
-skeeps curl quiet by hiding progress meter and error messages
-Sshows an error message if it fails (stderr)
-fFail silently (no output at all) on server errors, keeping stdout clean
-ospecifies an output file