thanks guru the problem was resolved .
but i got syntax error at error while executing . please help me friends,
1 #!/bin/ksh
2 ##
3 ##### To find no of files in the directory
4
5
6 NOF=`ls -l /root/COMM/LOGS/eds/20081025| wc -l`
7 if [ $NOF -ne 0 ]
8 then
9 NOF=`expr $NOF - 1`
10 fi
11
12 OUTFILE="/root/temp/checking/outputfile"
13 #OUTFILE= /root/temp/checking/outputfile
14 FILE=`cat /root/temp/checking/address.txt | wc -l`
15
16 echo " /root/COMM/LOGS/eds/20081025 no of files is ${NOF} " > $OUTFILE
17
18
19 if [ $NOF -ne 0 ]
20 then
21
22 for i in $FILE;
23 do
24 TO=`head -$i /root/temp/checking/address.txt | tail -1`
25
26 MFILE=/root/temp/checking/mailfile
27
28 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
29 echo "To: ${TO}" >> $MFILE
30 echo "Date: `date`" >> $MFILE
31 echo "Subject: due to the script execution problem " >> $MFILE
32 echo "\n\n" >> $MFILE
33 echo "Dear Sir/Madam," >> $MFILE
34 echo "\n\t Due to the script execution problem the following file are created" >> $MFILE
35 echo "\n\n `ls -lt /root/COMM/LOGS/eds/20081025 | tr -s " " | cut -f6,7,8,9 -d " " `" >> $MFILE
36 echo "\n" >> $MFILE
37
38 ##/bin/cat $MFILE | /usr/sbin/sendmail
-fgnanaprakasam@yahoo.com $TO
39 sleep 2
40 done
41
42 fi
43
44
45
46
47
48 NOF1=`ls -l /root/COMM/LOGS/eds/20081215 | wc -l`
49 if [ $NOF1 -ne 0 ]
50 then
51 NOF1=`expr $NOF1 - 1`
52 fi
53
54 echo text >> $OUTFILE
55 DIRFILE=/root/COMM/LOGS/eds/20081215
56 echo "/root/COMM/LOGS/eds/20081215 no of files is ${NOF1} " >> $OUTFILE
57 if [ $NOF1 -ne 0 ]
58 then
59 for j in $DIRFILE;
60 do
61 temp=`ls -lt /root/COMM/LOGS/eds/20081215 | tr -s " " | cut -f6,7,8,9 -d " " `"
62 echo "test j prakash" $j
63 echo "test temp prakash" $temp
64 echo "test DIRFILE" $DIRFILE
65 done
66 for i in $FILE;
67 do
68 echo test start
69 echo "test i prakash"$i
70 echo test stop
71 TO=`head -$i /root/temp/checking/address.txt | tail -1`
72
73 MFILE="/root/temp/checking/mailfile"
74 TEST=`ls -lt /root/COMM/LOGS/eds/20081215`
75
76 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
77 echo "To: ${TO}" >> $MFILE
78 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
79 echo "To: ${TO}" >> $MFILE
80 echo "Date: `date`" >> $MFILE
81 echo "Subject: due to the script execution problem " >> $MFILE
82 echo "\n\n" >> $MFILE
83 echo "Dear Sir/Madam," >> $MFILE
84 echo "\n\t Due to the script execution problem the following file are created" >> $MFILE
85 echo "\n\n `ls -lt /root/COMM/LOGS/eds/20081215 | tr -s " " | cut -f6,7,8,9 -d " " `" >> $MFILE
86 echo "\n" >> $MFILE
87
88 #/bin/cat $MFILE | /usr/sbin/sendmail
-fgnanaprakasam@yahoo.com $TO
89 sleep 2
90 done
91 fi
+ 1>> /root/temp/checking/outputfile
monitortest1.sh[56]: syntax error at line 86 : `"' unmatched
i have checked .there is no white space
Am using HP-UX and ksh shell