bash while-read drops a file without trailing newline
Iterating a list of ids from a file with bash while-read to call an API per line.
while IFS= read -r x; do …; done < file exits when read returns nonzero on the last line if that line has no terminating newline — so the final entry is silently skipped. Bit me with a 16-line ids file where only 15 calls fired. Fixes: write the file with a trailing newline, or use while IFS= read -r x || [ -n "$x "]; do …; done to also process the un-newlined tail, or just xargs -I{} instead. Either way, after a batch loop, re-query the source of truth and diff against the intended set rather than trusting the success counter.
When generating an id-list file from Python and piping to a bash loop, end the file with a newline OR use the || [ -n ] guard pattern, and always verify by re-fetching state.