if test `curl -s -w %{http_code} -u $SAP_USER:$SAP_PASS -d $BC_XMLDATA -o $TEMPFILE $BC_URL` == 200 ; then echo Successfully retrieved data, now correcting it (cat $TEMPFILE && echo -n '') | perl -pne ' s/&/&/g; # and a few other corrections ' > corrected.xml else echo Error fetching data from Business Connector exit 1 fi