次のスクリプトは、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 ]]' どこで間違ったのですか? ありがとう