You can check for exit code using $?:

exit_status = $?
if [ $exit_status != 0 ]
  then
    exit $exit_status
fi


If you want to analyze exit status, take a look at the Exit codes section from  man curl page. There are a lot of different codes, depending on why it failed.

EDIT : You can use command1 || command2 as well. command2 is executed if and only if command1 has failed:

curl .... || exit 1


How to stop shell script if curl failed
Windows 8.1 is out, and I would like to know if it is possible to share the Windows 8.1 download upgrade between different computers so that I don't have to download it over and over again?

This might be helpful for people who are on a metered connection. Store is downloading 3.42&nbsp;GB of data so it must be stored somewhere. Is there a way I can copy it to my other computers and start the setup so that I don't have to download it over and over again on each computer I own?
