There are a lot of ways to address this. read up on bash conditionals.
Basically, you just have to make sure you check both conditions interdependently. You are checking them with entirely separate statements.
You could base the loop itself on a combined condition -
while [[ -z "$tick" && -z "$tock" ]]; do echo all good; sleep $someTime; done
echo call support
or make one condition internal to the other if you want more detailed logging...
while :
do if [ -n "$tick" ]
then echo "Ticking..."
if [ -n "$tock" ]
then echo "BOOM! call for support now"
break
fi
fi
done
if statements in bash are pretty flexible. If you know they are integers you can even evaluate them mathematically.
while : ; do
if ((tick && tock));
then echo "call support!"; break;
else date; sleep $delay;
fi
done
Just make sure you check both collectively (with or without log output at various steps, as appropriate to your needs) in a structure that best fits your requirements.
addendum
If you always need to check both, and exit if either have a value, but also always want to report if BOTH have a value, use an OR followed by an AND.
while : ; do
if ((tick || tock)); # is either true?
then printf "call support! " # primary message
echo "tick='$tick' tock='$tock'"; # relevant info
if ((tick && tock)); # are BOTH true?
then echo "BOTH triggers - call support NOW!" # extra message
fi
break; # exit the loop either way? then do here BELOW 2nd IF
else date; sleep $delay;
fi
done
If you need to know which for extra logic, you can still use OR for higher efficiency before checking more carefully on a hit.
while : ; do
if ((tick || tock)); # is either true?
then echo "call support!" # primary message
if ((tick)); then echo "tick='$tick'"; fi # relevant action block
if ((tock)); then echo "tock='$tock'"; fi # relevant action block
if ((tick && tock)); # are BOTH true?
then echo "BOTH triggers - call support NOW!" # extra actions
break; # ONLY exit the loop if BOTH true? do INSIDE here
fi
else date; sleep $delay;
fi
done
Using ((tick||tock))
means if $tick
is empty it will test $tock
, which is 2 checks each loop, which isn't bad. Once either hits, dive deeper to see what actually happened in little steps as needed.