0

次のスクリプトは、Web サイトから映画のタイトルをスクレイピングします。

#!/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"
}

「720p」が含まれている場合にのみ $title をエコーし​​たい。スクリプトを実行すると、次のエラーが返されます。予期しないトークン `if' 付近の構文エラー [[ "$title" == 720p ]]' どこで間違ったのですか? ありがとう

4

1 に答える 1

0

doあなたはその前を忘れましたfor

于 2012-10-07T03:25:02.647 に答える