Skip to content

Tweak curl snippets – hide progress but show errors

Nikolay Samokhvalov requested to merge nik-tweak-curl-snippets into master

add -fsSL to curl snippets:

-f or --fail: This option tells curl to fail silently (without displaying an error message) if the HTTP response code indicates an error (e.g., 404 Not Found or 500 Internal Server Error). When this option is used, the command exits with a non-zero status code if an error occurs, making it easy to detect and handle errors in scripts.

-s or --silent: This option silences curl's progress meter and error messages, resulting in a completely quiet operation. It is particularly useful when you want to fetch a file or script and process its contents without any additional output.

-S or --show-error: When used with --silent, this option makes curl show an error message if it fails, despite the silent mode. This is helpful for understanding what went wrong while still keeping the overall operation quiet.

-L or --location: This option tells curl to follow any HTTP redirects (e.g., 301 Moved Permanently or 302 Found) encountered during the request. This is useful when downloading files or scripts from servers that use redirects to manage content or enforce HTTPS.
Edited by Nikolay Samokhvalov

Merge request reports