I have a script that uploads a file to a WebDav server using curl.
curl --anyauth --user user:password file http://webdav-server/destination/
I want two things at the same time:
- have the script output to stdout (which is directed to a log file)
- detect whether the upload succeeded
As far as I know, curl returns an exit code of 0 even in 401(unauthorized) or 407(conflict) situations. The --fail option can be used to change this behavior, but it suppresses stdout.
What would be the best workaround for this? tee and grep?