OVH Cloud OVH Cloud

Double negative

1 réponse
Avatar
MarzBarzTM
I can use a IF statement responding when a file is empty with:

if [ ! - file1 ]; then action1 ;fi

But I need a specific action when 2 specific files are empty in the same
time then:

if [ ! -s file1 -a \(! -s file2 \) ]; then action2 ;fi

didn't worked and I tried a couple of variations without success. What
is the proper form?

1 réponse

Avatar
JustMe
MarzBarzTM wrote:

bonjour ?

I can use a IF statement responding when a file is empty with:

if [ ! - file1 ]; then action1 ;fi


on va supposer que tu as voulu ecrire "-s" au lieu de "-"


But I need a specific action when 2 specific files are empty in the same
time then:

if [ ! -s file1 -a (! -s file2 ) ]; then action2 ;fi

pas besoin de parentheses


didn't worked and I tried a couple of variations without success. What
is the proper form?


ca marche chez moi...