I would like some curl command, possibly with some bash hackery, that:
- Outputs any 2xx responses to a file
- Outputs any non-2xx responses to stderr
- Exits with a nonzero status code when a non-2xx response occurs
I know that the
-f flag will get me 3, and that
-o or pipe redirection will get me 1. But I cannot then figure out how to get 2.