我有这段代码:
file="/dir/conf/file.config"
# while loop
while IFS='|' read -r source target filecount
do
echo "source: ${source}"
echo "target: ${target}"
echo "filecount: ${filecount}"
echo "======================="
done < "$file"
此代码的工作是读取此配置文件:
Source1|Target1|1
Source2|Target2|2
Source3|Target3|4
Source4|Target4|3
Source5|Target5|6
读取在Source4处停止,并跳过最后一行。 如何确保它读取所有行? 谢谢!