以下脚本从网站上抓取电影标题
#!/bin/bash
parse_url() {
ids=$(curl -s "$1" | grep -o -P '(?<=list.php\?mid=)\d+')
for id in $ids
do
titles=$(curl -s "http://subtitle.co.il/view.php?id=$id&m=subtitles#${id#1}" | grep -o -P '(?<=style="direction:ltr;" title=")(.*?)(?=">)')
for title in $titles
if [[ "$title" == *720p* ]]
then
echo "$title"
fi
done
done
echo "done"
}
我只想在 $title 包含“720p”时回显它。当我运行脚本时,它返回以下错误: 意外标记 'if' 附近的语法错误 if [[ "$title" == 720p ]]' 我哪里出错了?谢谢