Shell script for curl-based deletes

#!/bin/bash

SERVICE="cspace-services/personauthorities/2df0880c-2576-4127-b1a8/items"
CONTENT_TYPE="Content-Type: application/xml"
URL="http://localhost:8180"
USER="admin@TENANT.cspace.berkeley.edu:PASSWORD"

flag=1
count=0

while read CSID
do
  if [ $flag -eq 1 ]
  then
    echo "curl -X DELETE $URL/$SERVICE/$CSID -u \"$USER\" -H \"$CONTENT_TYPE\""
  fi
  count=$((count+1))
  echo -n "${count}: $CSID"
  curl -X DELETE $URL/$SERVICE/$CSID -u "$USER" -H "$CONTENT_TYPE"
  echo $CSID >> deleted.list
  echo " : Sleeping"
  sleep 30
  flag=0
done < todelete.list