I have a function where in I'm trying to compare the first parameter to a string, and then a separate boolean variable.
My sample bools:
EMS=true;
COLL=true;
At a given point, both or any one or none of them can be true.
My function body:
function some_function() {
...
...
if [ [ "$1" = "ez" ] && $EMS ] || [ "$1" = "coll" ] && $COLL ]; then
#do mysterious magic
...
...
fi
}
I'm calling the function like so:
some_function ez
some_function coll
However when I execute the script, I run into this:
./deployBuild.sh: line 145: [: too many arguments
My if loop is incorrect and I'm unable to fix it. How do I proceed with?
Pseudo code of what I want to achieve:
if ("$1" is "ez" AND $EMS evaluates to true) OR ("$1" is "coll" AND $COL evaluates to true)
Aucun commentaire:
Enregistrer un commentaire