While loop with limit counter

#!/usr/bin/ksh

c=0
while [[ ! -f /tmp/unex || $c -lt 10 ]]; do 
    echo /tmp/unex NOT found, iter : $c;
    ((c = $c + 1));
    sleep 2; 
done

so, the above counter doesn't work, already tried both -lt & -gt, and changed || to &&

so what am I missing?

Thanks in advance

change || to &&

Does the file /tmp/unex exist? If it does not exist, is there some reason to think that it might be created while your script is running? If it does exist, is there some reason to think that it might be removed while your script is running?

What output are you getting?

What output do you want to get?

With no indication of what you are trying to do and no indication of the state of the conditions being tested by your script, it is hard to guess at what you might think right or wrong?

Ah my bad, I am trying to detect the file to see if it existed, but cannot have it run indefinitely, so I've put the counter as a limit

using || or &&, the counter still went beyond 10, in which I expect after trying to detect the file 10 times, the script will quit

When I try your script with || changed to && :

#!/bin/ksh

c=0
while [[ ! -f /tmp/unex && $c -lt 10 ]]; do 
    echo /tmp/unex NOT found, iter : $c;
    ((c = $c + 1));
    sleep 2; 
done

(note that ksh is in /bin instead of /usr/bin on my system) and the file /tmp/unex does not exist; I get the output:

/tmp/unex NOT found, iter : 0
/tmp/unex NOT found, iter : 1
/tmp/unex NOT found, iter : 2
/tmp/unex NOT found, iter : 3
/tmp/unex NOT found, iter : 4
/tmp/unex NOT found, iter : 5
/tmp/unex NOT found, iter : 6
/tmp/unex NOT found, iter : 7
/tmp/unex NOT found, iter : 8
/tmp/unex NOT found, iter : 9

and it then quits. Isn't that what you want?

oh yes, thank you so much