curl has an option -f which allows it to fail silently. Such an option will simplify the code for the scripts.