Hereby my code:
while [ -f $load_extract_process ] || [ -f $Sr_details_update_process ]
do
sleep 3s
echo "mango"
done
echo "completed"
I want to check any one of the triggers is present. In that case, go to sleep mode, else print "completed".
Your example code is missing just one character, a !. You want the loop to continue until one of the file exists, not while it exists. So the following code will work:
while ! [ -f /tmp/a1 ] || [ -f /tmp/a2 ]; do sleep 1; echo sleeping; done
Instead of the shell's ! and ||, you can also use parameters from within test ([ is just an alias for test):
while [ ! -f /tmp/a1 -a ! -f /tmp/a2 ]; do sleep 1; echo sleeping; done
Note how ! is now handled by test ([) not by the shell, and -a means and.
You decide which of the two implementations is clearer to you (in my opinion, it's the second).