In bash, we would like to do the following logic: if the variable "$SLACK"
is TRUE
and ${OUTPUT}
is not equal to "mysql: [Warning] Using a password on the command line interface can be insecure"
, call the slack_it
function.
I have tried more than a dozen solutions provided from the posts here How do I negate a test with regular expressions in a bash script?, Check if a string matches a regex in Bash script, but none of them work. Could any guru enlighten?
#!/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