Eu fiquei com um comportamento estranho de readarray
comando.
Os man bash
estados:
readarray
Read lines from the standard input into the indexed array variable array
mas esses scripts não funcionam (a matriz está vazia):
unset arr; (echo a; echo b; echo c) | readarray arr; echo ${#arr[@]}
unset arr; cat /etc/passwd | readarray arr; echo ${#arr[@]}
E estes funcionam:
unset arr; readarray arr < /etc/passwd ; echo ${#arr[@]}
unset arr; mkfifo /tmp/fifo; (echo a; echo b; echo c) > /tmp/fifo & mapfile arr < /tmp/fifo ; echo ${#arr[@]}
O que há de errado com o cachimbo?
< <
2 flechas?