vendredi 4 septembre 2015

How do I declare a conditional that includes "or" on the command line?

I'm trying to write an if/then statement on the command line that takes two conditions. I can't seem to get the syntax right. I've tried:

if [ "$var1" == "value1" || "$var2" == "value2"]; 
if [ "$var1" == "value1"] || ["$var2" == "value2"]; 
if [[ "$var1" == "value1" || "$var2" == "value2"]]; 

All return errors. I know it's a basic question but I'm still fairly new to command line scripting. Any help is welcome.

Aucun commentaire:

Enregistrer un commentaire