나는 이상한 readarray명령 행동을 고수했다 .
man bash상태 :
readarray
Read lines from the standard input into the indexed array variable array
그러나이 스크립트는 작동하지 않습니다 (배열이 비어 있습니다).
unset arr; (echo a; echo b; echo c) | readarray arr; echo ${#arr[@]}
unset arr; cat /etc/passwd | readarray arr; echo ${#arr[@]}
그리고이 작품들 :
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[@]}
파이프에 어떤 문제가 있습니까?
< <2 개의 화살 이 있다는 것은 무엇을 의미 합니까?