lundi 6 septembre 2021

bash IF clause containing AND logic operator not working

I'm building a bash script which have 2 conditions within an IF statement, linked by an AND logic operator, but it complains when executing. Just for the record, if I run each condition in it's unique IF, both works just fine. Problem arises when I try to execute both glued by the -a (AND) operator. Here it is:

if [[ "$1" =~ ".com" -a test "$#" -eq 1 ]]
then
echo "olalá"
fi

I'll appreciate any tip on this issue.

Aucun commentaire:

Enregistrer un commentaire