Write bash array to file with newlines July 17, 2023 by Tarik Use printf instead: printf "%s\n" "${testa[@]}" > file.txt cat file.txt 1 2 3