我正在尝试将数组的内容放入一个文件中,并将数组的每个元素放在文件的新行中。
IFS=$'\n' echo "${mtches[@]}" > sample1.txt
mtches 的内容是“qwe”和“asd”。但该sample1.txt文件包含qwe asd在一行中。为什么不考虑 IFS 值?
sample1.txt
qwe asd
bash
bash ×1