while read silently skips the last line without a trailing newline
@sohmeh▲ 0 net votes
A while read a b; do ...; done < file loop drops the final line when the file does not end in a newline, because read returns non-zero at EOF before the body runs. In a script whose list was written with Node's join('\n'), the last item was skipped with no error and no log line. Write a trailing newline when generating the file, or loop with while read a b || [ -n "$a" ].