Re: Unix loop failing :

Re: Unix loop failing :

 

  

Ankur,

If it is failing at cd command,then before issuing cd
command, make sure that dir. path is directory. using

-d/D option.

Thanks
Jignesh


--- Ankur Shah <[Email Address Removed] wrote:
> I am at the last hurdle in my script :
>
> #-------------------------- CronJob for Mialing
> Reports ---------------------
> #set -v on
> cd /u01/sendss/mail
> for fle in `cat dirsearch.list`
> do
> echo $fle
> cd $fle
> ls -l | grep *.Now > tmp.out
> emailnow=`cat tmp.out |wc -l`
> if [$emailnow -ne 0 ]
> then
> type=`tail -1 *.info`
> attach=`head -1 *.info`
> echo $type
> echo $attach
> cat *.list > tmplist.out
> emailist=`cat tmplist.out |wc -l`
> if [$emailist -ne 0 ]
> then
> for mailname in `cat tmplist.out`
> do
> uuencode $attach $attach > report.doc
> echo $mailname
> echo $attach
> mailx -s "SENDSS OUTPUT FILE REPORT" $mailname <<
> EOT
> ~r report.doc
> "$type"
> EOT
> done
> fi
> fi
> done
>
>
> We need to loop through each directory at
> /u01/sendss/mail and
> then process the mailing of reports to individual
> email addresses in a
> mailing list within each directory
>
> Its failing at -
> cd $fle where it says
>
> $ ./mailreps.sh
> mmwr
> PLAIN TEXT
> MMWR.DAT
> [Email Address Removed] MMWR.DAT
> "report.doc" 9121/565293
> DynamicRep
> ./mailreps.sh: DynamicRep: does not exist
>
> $ cat dirsearch.list
> mmwr
> DynamicRep
> CancerRep
> LeadRep
> NewUser
> shutdown
> Epinfo
> hl7Rep
> DuplicateRep
>
> It works fine and sends mail from "mmwr" but fails
> to loop in directoriers
> down under "mmwr"
>
>
> Any ideas what's wrong - Any help would be greatly
> apprciated
>
> TIA
>
> Ankur Shah
> Oracle DBA
> DHR-GA
>
>
> --------
> Oracle documentation is here:
> http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
> To unsubscribe: send a blank email to
> oracledba-[Email Address Removed] To subscribe: send a blank email to
> oracledba-[Email Address Removed] Visit the list archive:
> http://www.LAZYDBA.com/odbareadmail.pl
> Tell yer mates about http://www.farAwayJobs.com
> By using this list you agree to these
> terms:http://www.lazydba.com/legal.html
>


=====
********************************************************************
American Red Cross Seeks Help For Indian Quake Victims http://www.disasterrelief.org/GiveHelp/
http://dailynews.yahoo.com/h/ap/20010126/wl/quake_aid_agencies_2.html
**********************************************************

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
Oracle LazyDBA home page