I need to read a file using a "Do/While" loop.
How can I read the contents as a string?
Here's my code:
cat directory/scripts/tv2dbarray.txt | while read line
do
echo "a line: $line"
done
Error:
test.sh: line 4: syntax error near unexpected token `done'
test.sh: line 4: `done'
whileorifor an unbalanced quote, brace, bracket or parentheses?# or - it might be copy-pasted (with some rich text, Which is messing up the file itself)how-why-what-is this I am typing? uhm; it have (put simply) happened to me a bunch--of-times when I copy-pasting code into libreoffice, then copy-pasting it back(having colored the text) so some in-visible characters also get's copied - really weird - but it still is the same problem; to solve it you just by-hand type it(cat directory...) (for long files this is a problem) (for short snippets like this one, it's easily and quickly typed)Just needed to throw that in for any future explorer`