Checking existence of file using file pattern

Hi Experts:),
I need to check the existense of file using patterns.How can i do it?
Ex:
if my current directory has a number of files of pattern (ins_*),
i need to check the existense of atleast one file.
pls reply me.

This seems to work for me. There may be (and probably is) a better way to do it.

 if test -n "$(ls ins_*)"; then echo "yep"; else echo "nope"; fi

ShawnMilo's response is pretty good, I think. Just to be sure, you might want to use:

 if test -n "`/bin/ls -1 ins_* 2>/dev/null`"; then echo "yep"; else echo "nope"; fi

Otherwise, you'll get a "file not found" error, or if your output starts with a dash, you'll have problems.

:slight_smile:
Thanks a lot ShawnMilo & Otheus...!
Its working fine.