I am executing a shell script in which one curl command is present. I have to store the output of curl command(xml format) in a file and display the result on screen. For this to happen "tee command" is used after curl using pipeline. I need to check if the curl command is executing successfully or not. I used $? but it is taking the exit status of tee command. I used PIPESTATUS and set -o pipefail but did not work for curl. How do i check if the curl command is executing successfully or not? How do I store the exit status of curl command in a variable? This is just a demo code.
curl output | tee -a filename
I want to know the exit status of curl