It seems readarray
blocks and does not return when the input is redirected from a process using <
, but it works when input is coming from a pipe |
.
This works:
$ (printf "line 1\nline 2\nline 3\n") | (readarray -t ARR ; echo "${ARR[1]}")
line 2
This does not return and needs to be killed
$ readarray -t ARR <(printf "line 1\nline 2\nline 3\n"); echo "${ARR[1]}"