I need 4 things from curl in a BASH script:
- I need to capture brief humanly readable error message from curl into a bash variable.
- I need to be able to check that the command completed successfully or not.
- I need the command to run
- I don't want anything printed to console unless I echo it.
m=$(curl -u "$user":AP"$pass" -T "$pathA" "$url") if [ $? -ne 0 ] ; then echo "Error: ""$m" fi
The problem is curl puts gibberish into $m. It just dumps the error to console instead of m. I don't want anything printed to console unless I echo it. And I only want to capture error descriptions. I tried many variations, nothing seemed to work for this use-case... at least nothing suggested here on Stack.