Turns out, I was doing it right with the -d
switch. However, bash's read
exits with code 1 when it encounters EOF. Documented behavior, explained [here|/questions/40547032]... (Makes sense, actually, as it allows you to loop over text with while read ...
)
Because I want the -e
to catch all unexpected failures, I modified the parsing line to ignore the expected one: read -r -d '' num1 num2 name <<< $data || :
, as suggested by @pjh in his comment, and now the script works properly.