mercredi 20 janvier 2021

Multi Add, Or in If - Bash [duplicate]

I want to add 3 conditions in one if in bash, for some reason that error out on me. I want to check if *.gz file exists, otherwise, if *.zip exists, if it does - check it is not empty.

[nir data]$ if [ -f *.gz  ] || [[ [ -f *.zip ] && zipinfo *.zip ]]; then echo 1 ; else echo 2 ; fi
-bash: conditional binary operator expected
-bash: syntax error near `-f'

Aucun commentaire:

Enregistrer un commentaire