The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-25-2008
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,433
Replace && by -a

Code:
inputfile1=data/in/inputfile1.txt
inputfile2=data/in/inputfile2.txt

if [  ! -f ${inputfile1} -a ! -f ${inputfile2} ]
then
   echo " "
   echo "ERROR: Both files not found."
   echo " "
   exit 1
fi

if [  ! -f ${inputfile1} -o ! -f ${inputfile2} ]
then
   echo " "
   echo "ERROR: File(s) not found."
   echo " "
   exit 1
fi

echo " "
echo "RUN SUCCESSFUL: Both Files found. "
echo " "

exit 0

jean-Pierre.

Last edited by aigles; 04-25-2008 at 10:02 AM.. Reason: 'exit 0' is a better choice for successful execution