Anytime a filename pattern expansion yields two or more pathnames, tests like:
[ -f pattern ]
will yield a syntax error or (due to the names and number of files involved) unexpected, unreliable test results. You will only get valid results if pattern expands to a single word. NEVER use an * in a pattern in a test like this.
Instead try something like:
for i in /usr3/tstsrc/test/anitha/*.done /usr3/tstsrc/test/anitha/*.zip
do if [ -f "$i" ]
then echo "Found"
break
fi
done
The last one won't work. The ls utility will return a non-zero exit status if any file operand names a file that does not exist. And, you don't need command substitution here. Perhaps you meant something like:
(ls *.done 2>&1 > /dev/null || ls *.zip 2>&1 >/dev/null) && echo Found || echo NONE
The first one also needs to redirect stderr to /dev/null from the ls to avoid unwanted diagnostic output.
Hmm - works for me with bash. It's testing for the non-zero string the ls command substitution gives back and reacts correctly. If there's two non-existing and one existing pattern, it echoes "found". If none of the patterns exists, it echoes "NOK" - I can't say if due to the zero string or due to the exit code.