Chris Hansen
Chris Hansen

Reputation: 8663

How to I make sure that curl doesn't fail a script?

How do I make sure curl errors doesn't fail a script? I want to send all errors from curl to Dev null so that it doesn't fail a script and the script keeps going

What's the proper curl command to do that.

I tried curl --fail http://...

For curl to fail silently

Upvotes: 7

Views: 8336

Answers (1)

Jay Sullivan
Jay Sullivan

Reputation: 18279

Have you tried:

curl http://.../ || true

And if you want to hide any error output, have you tried:

curl http://.../ 2>/dev/null || true

(Note: Untested.)

Upvotes: 8

Related Questions