Script doubt

From: Goutham.Nithyanandam@in.standardchartered.com
Date: Thu Mar 30 2006 - 07:59:19 EST


Hi All,

   I have a doubt in shell script.

   In my script i m searching for 2 files in a particular directory where
the script will reside.

The script should check for two keywords PARTIAL, FULL. If the file
exists it should start the work

With some help i had done a part, but still facing issues. Can any one
help

The below is the script which i have done.

 #! /bin/sh
     2 PARTIAL="`ls *PARTIAL* 2>/dev/null`"
     3 FULL="`ls *FULL* 2>/dev/null`"
     4 if [ -z "$PARTIAL" ] && [ -z "$FULL" ]; then
     5 echo "ERROR: no files found"
     6 #exit
     7 fi
     8 nbfiles=`echo $PARTIAL $FULL|wc -w`
     9 nbfiles=`expr $nbfiles + 0`
    10 if [ $nbfiles -gt 1 ]; then
    11 echo "ERROR: Too much files caught($nbfiles): \n$PARTIAL \n$FULL"
    12 exit 2
    13 fi
    14
    15 if [ -f $PARTIAL ]; then
    16 echo "inside if statement"
    17 elif [ -f $FULL ]; then
    18 echo "eliff statement"
    19 else
    20 echo "OK: correct file not found, Hence exited"
    21 fi

Thanks in Advance

Regards,
N. Gowthaman

This email is confidential. If you are not the addressee tell the sender immediately and destroy this email without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay, interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for damage caused by this email and may monitor email traffic.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:39:28 EDT