簡體   English   中英

為什么在我的 Bash 腳本中出現“意外標記‘完成’附近的語法錯誤”?

[英]Why do I get "syntax error near unexpected token `done'" in my Bash script?

我有這個 Bash 腳本:

#!/bin/bash

while read -r line; do
    ip="$line"
    torify ./PRET/pret.py $ip pjl -q -i ./commands.txt
done < "./potential_bros.txt"

為什么我會收到這個錯誤?

命令.txt=

print ./message.pdf
display Completed
quit

potential_bros.txt = 我的 ip

PRET = https://github.com/RUB-NDS/PRET

我無法重現此錯誤。 有效的例子:

$ cat t.sh
while read -r line ; do
  echo $line
done  < t.txt

$ cat t.txt
item1
item2
item3

$ ./t.sh
item1
item2
item3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM