I am trying to string together if [[]] statements together with && boolean operator. It works up until the 6th one. I can see the code color changes in my atom application and when I paste it in shell as a function to test it fails.
How many of these can you string together or what is another option if 6 is the limit?
test-case()
{
var=0
var1=0
var2=0
var3=0
var4=0
var5=0
var6=0
var7=0
var8=0
var9=0
if [[ $var -eq "0" ]] && [[ $var -eq "0" ]] && [[ $var -eq "0" ]] && [[ $var -eq "0" ]] && [[ $var -eq "0" ]] && [[ $var -eq "0" ]] && [[ $var -eq "0" ]] [[ $var -eq "0" ]] [[]]; then
echo "0"
else echo "not0"
}
user@host$ paste contents above to test the syntax results in: -bash: syntax error near unexpected token `}'
Aucun commentaire:
Enregistrer un commentaire