when: I paste muti-line bash script into terminal
example:
for ((i=0; i<5; i++)); do
echo "$i"
done
error:
bash: eval: line 2: syntax error: unexpected end of file from `for' command on line 1
It seems that the issue occurred because a ; was not added when multiple lines of text were merged into one line.
# error(one line)
for ((i=0; i<5; i++)); do echo "$i" done
# success(one line)
for ((i=0; i<5; i++)); do echo "$i" ; done
# It can also run successfully when pasted into fish
btw, if the first line starts with #, it will not be executed either (may be the same reason).
when: I paste muti-line bash script into terminal
example:
error:
It seems that the issue occurred because a
;was not added when multiple lines of text were merged into one line.btw, if the first line starts with
#, it will not be executed either (may be the same reason).