我在 CygWin 中使用这个脚本:
#!/bin/sh
rm -f nplist.txt
find . -name "*.html"| while read file; do
awk '
/titleTable/ { if (NR==53) match1=1 }
/id="maincontainer"/ { if (NR==169) match2=1 }
{ if (match1 && match2) exit 69 }
' file
if test $? -eq 69; then
echo $file
sed -i '53,121d; 166,168d' $file
else
echo $file >>nplist.txt
fi
done
..终端告诉我:
/cygdrive/c/1/test.sh: line 14: syntax error near unexpected token `done'
/cygdrive/c/1/test.sh: line 14: `done'
为什么?拜托,有人帮帮我!