虽然循环在1次迭代后停止[BASH]

时间:2017-08-09 12:27:19

标签: linux bash while-loop

我必须使用bash读出一个CSV文件。 但我的循环在1次迭代后退出。

代码:

function readCSVFile () {
input="bitbucket-repositories.csv";
OLDIFS=$IFS
IFS=","
while read repo tool folder;
do
  cd websites || exit
  cloneRepo $repo
  checkRepo
  cd ../ || exit 0
  checkTool  -> calls another script (../script.bash) -> no ssh
  countCSVLines
done < $input
IFS=$OLDIFS

}

1 个答案:

答案 0 :(得分:1)

从stdin读取哪些自定义命令?其中一个是消耗输入文件的其余部分。

尝试为while读取循环使用不同的文件描述符:

while read -r -u3 repo tool folder; do ... done 3< "$input"
相关问题