The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-03-2003
TioTony's Avatar
TioTony TioTony is offline
Bit Pusher
 

Join Date: Oct 2001
Location: Southern California
Posts: 332
Since you are only concerned if at least 1 file exists this may work for you:
Code:
mylist="janfile.tar jarfile.jar jan.rpt.Z" 
for i in $mylist
do
   if [ -e $i ]
   then
     echo found $i   #or e-mail and halt
     exit 0
   fi
done
The -e just checks to see if the file exists. If it does, then the expression is true and the echo is run.

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 06:11 PM.