bashでは、変数"$SLACK"
がTRUE
で、${OUTPUT}
が"mysql: [Warning] Using a password on the command line interface can be insecure"
でない場合、slack_it
関数を呼び出します。bashスクリプトで正規表現を使用して2つの論理テストを否定するにはどうすればよいですか?
私はここで投稿から提供される十数個のソリューションを試しましたHow do I negate a test with regular expressions in a bash script?、Check if a string matches a regex in Bash script、しかしそれらのどれも動作しません。どの教祖が啓発できますか?
#!/bin/bash
if [ "$SLACK" == "TRUE" ]
then
if ! [[ ${OUTPUT} =~ "*mysql: [Warning] Using a password on the command line interface can be insecure*" ]]
then
slack_it
fi
fi
が、私は好奇心旺盛です。あなたが正規表現なしで動作するように思えます。なぜ複雑なこと?それとも、これは心の運動ですか? – BillR