【发布时间】:2019-01-31 17:31:30
【问题描述】:
我需要使用“Do/While”循环读取文件。
如何将内容读取为字符串?
这是我的代码:
cat directory/scripts/tv2dbarray.txt | while read line
do
echo "a line: $line"
done
错误:
test.sh: line 4: syntax error near unexpected token `done'
test.sh: line 4: `done'
【问题讨论】:
-
这段代码没有问题。脚本中还有其他内容吗?也许是另一个
while或if或不平衡的引号、大括号、方括号或圆括号?
标签: bash