whileコマンドのヘルプが必要です。私は$のサイト名はplaylist.txt
であるかどうコマンドを実行したい。ここに私のbashです:
cat playlist.txt | grep -e "$sitename" | sed -e "s/^.*\(http:.*"$sitename".*flv\).*$/\1/g" | sort | uniq > checklist.txt
cat checklist.txt
while [ " While can find $sitename in checklist.txt" ]; do
qa
done
私はコマンド場合は一時的に、私は多くを入れて、既に
while [ -n "$echopl" ]; do
qa
done
while [ 'grep -q $string checklist.txt >/dev/null' ]; do
qa
done
while [ "grep -q "$string" checklist.txt" ]; do
qa2
done
while grep -q "$string" checklist.txt; do
qa
done
while grep -q '$string' checklist.txt; do
qa
done
if grep -q "$string" checklist.txt ; then
qa
fi
しようとしたものだという。 (
ifmorelinks ifmorelinks ifmorelinks ifmorelinks ifmorelinks
を。ありがとう! –
man grep(1)から:_ポータビリティノート:GNU grepとは異なり、第7版Unix grepは-qがなく、-sオプションがGNU grepの-qオプションのように動作するため、POSIXに準拠していませんでした。 USGスタイルのgrepにも-qはありませんでしたが、-sオプションはGNU grepのように動作しました。移植可能なシェルスクリプトは、-qと-sの両方を避け、標準出力とエラー出力を/ dev/nullにリダイレクトする必要があります。 –
この解決策には問題があります: '$ string'に正規表現メタ文字が含まれていると解釈されます!だから、文字列に 'a.com'と答えたら、あなたのチェックリストにある 'fatcomparse.org'にマッチします。代わりに 'fgrep'を使うか、' grep -F'を使うのがよいでしょう。また、 '-w'オプションを考慮してください。 – fge