我一直在編寫一個unix腳本,它將掃描文本文件,查找特定單詞的實例,然後刪除另一個文檔中的相應行。一切都在努力,直到我去測試我最近的嘗試,我得到:意外標記'done'附近的語法錯誤
./Present.sh: line 35: syntax error near unexpected token `done'
./Present.sh: line 35: ` done'
我不知道爲什麼。谷歌搜索錯誤給我一些來自unix.com的迴應,但沒有任何價值(嘗試其他有這些問題的人的建議並沒有幫助解決問題)。非常感謝你的幫助!!!
我的代碼是:
for var in bent bound bled bred brought built burned burnt bought caught clung crept dealt dug dived dreamed dreamt fed felt fought found fled flung ground hung heard held kept knelt laid led leaped leapt learned learnt left lent lighted lost made meant met misspelled misspelt mowed mown paid pled proved proven sawed sawn said sought sold sent sewed sewn shaved shaven shone shoed shod shot showed sat slept slid slung sowed sown sped spent silted spilt spun sprung stood stuck stung struck strung swept swelled swollen swung taught told thought thrived understood upheld waved woven wept wound won withheld withstood wrung
do
cd ~
cd Documents/UPenn/'Senior Year'/'Spring 2011'/Thesis/Results/
echo "$var"
NUMLINE=0
cat 'foradam.txt' | while IFS=$'\t' read -r word pos other; do
if [ "$word" = '#' ] || [ "$word" = Number ] || [ "$word" = CHI ]; then
NUMLINE=`expr $NUMLINE + 1`
echo "error 1"
echo "$word"
echo "$NUMLINE"
if [ "$word" = $var ] && [ "$pos" = VVN ];then
sed -i '$NUMLINE' d Brown_Adam_CIVForms.txt
echo "error 4"
echo "$word"
echo "$NUMLINE"
else
echo "nothing on this line"
echo "$word"
echo "$NUMLINE"
fi
done
done
嗨taspeotis,謝謝你看我的問題!拿走其中一個人仍然給我同樣的錯誤。 ./Present.sh:第35行:語法錯誤附近的意外令牌'完成' ./Present.sh:第35行:'完成' – Dave 2011-04-11 03:00:56