samedi 7 mars 2020

BASH conditional if statement ANDing two commands that output true or false

In BASH, I have an if statement like so:

if dokku ps:report $APP_NAME --deployed && ! dokku certs:report $APP_NAME --ssl-enabled; then echo "works"; fi

Each command outputs true or false. I want the then clause to get executed when the first command outputs true and the second outputs false (which is why I have the !). But when I run this, it outputs:

true
false

If I run the second command individually:

dokku certs:report $APP_NAME --ssl-enabled

It outputs false. So the negation in my original if statement isn't working. What am I doing wrong here?

Aucun commentaire:

Enregistrer un commentaire