Hey,
Need some help with a script I'm making to automate bulk removal of computers using the API.
It all seems to work fine, it loops through a file grabbing a serial off each line, all the variables do what they should. But, the URL always flags as "curl: (3) URL using bad/illegal format or missing URL" even though the URL thats outputted works fine if I copy and paste it in to a browser.
#!/bin/sh
while IFS= read -r line
do
echo "serial to delete is $line" >> /Log/Path/Deleted.txt
curl -u "USERNAME:PASSWORD" -X DELETE "https://COMPANY.jamfcloud.com/JSSResource/computers/serialnumber/$line" >> /Log/Path/Deleted.txt
echo "https://COMPANY.jamfcloud.com/JSSResource/computers/serialnumber/$line" >> /Log/Path/Deleted.txt
echo "DELETED" >> /Log/Path/Deleted.txt
done < "$file"
I've tried the URL without "", tried ${line}, "$line", "${line}". Tried without the output after the URL incase that was messing it up.
Can't figure out whats going wrong?!