I would like to know how I can create a log or have control of the data that is updated or not in this bash script I read a csv and send the data with CURL and the .sh works correctly now I would like to generate a log of errors or have a message that tells me which fields were updated
while IFS=, read col1 col2 col3 col4 col5 col6 col7 col8
do
echo "_________________________________"
echo "Nombre del Sitio de Proveedor ->[${col1}]"
echo "NIT del proveedor -> [${col2}]"
echo "Email de notificación -> [${col3}]"
echo "Grupo de contenido -> [${col4}]"
echo "CODE -> [${col5}]"
echo "COD S1ESA -> [${col6}]"
echo "CODE NUEVO -> [${col7}]"
echo "ACTIVO -> [${col8}]"
url="https://example.com/api/suppliers?number=${col2}"
echo "COnsultando "$url
curl -g -H "Accept: application/xml" -H "X-COUPA-API-KEY:3bce24adc7ef16199c10c6dec2d1980a612f4bb3" -H "X-HTTP-Method-Override: GET" $url >nit.xml
Supplier_id=$(cat nit.xml | xmlstarlet sel -t -m "//supplier" -v "id")
echo $Supplier_id
url="https://example.com/api/suppliers/"$Supplier_id"/supplier_sites?code=${col5}"
echo $url
curl -g -H "Accept: application/xml" -H "X-API-KEY:3bce24adc7ef16199c10c6dec2d1980a60000012" -H "X-HTTP-Method-Override: GET" $url >nit1.xml
supplier_site_id=$(cat nit1.xml | xmlstarlet sel -t -m "//supplier-site" -v "id" )
echo "id_site" $supplier_site_id
IFS='-' read -ra contentG <<< "${col4}"
for i in "${contentG[@]}"; do
echo "$i"
"<supplier-site><content-groups><content-group><name>${col4}</name></content-group>/<content-groups></supplier-site>"
done
url_put="https://example.com/api/suppliers/"$Supplier_id"/supplier_sites/"$supplier_site_id
curl -g -X PUT -d "<supplier-site><content-groups><content-group><name>$i</name></content-group></content-groups><name>${col1}</name><po-email>${col3}</po-emai$ echo "<supplier-site><content-groups><content-group><name>${col4}</content-groups>/<content-group></name><name>${col1}</name><po-email>${col3}</po-email><acti$
done < campos.csv