![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Seek UNIX script tutor and help | duke0001 | UNIX for Advanced & Expert Users | 2 | 05-12-2008 08:08 AM |
| The loop that dosent work | jadionne | UNIX for Dummies Questions & Answers | 12 | 01-11-2008 06:25 AM |
| Modify Perl script to work with txt - Permissions script | joangopan | Shell Programming and Scripting | 1 | 09-12-2007 08:38 PM |
| Script doesn't work, but commands inside work | cheongww | UNIX for Dummies Questions & Answers | 2 | 11-14-2006 07:52 PM |
| Top level TCSH while Loop doen't work | sprynmr | UNIX for Dummies Questions & Answers | 1 | 02-04-2005 02:25 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Why script For...Loop doesn't work. Seek help
I have written a script to run on UNIX server. When I tested, it always hanged on after "date +"%D %T: XXXXXX script started." part. Then it wouldn't go further. UNIX server gave me one error message. I used the same code in another script. It works fine. I think the major problem may be in For...Loop part. The script can not access into the $filename. I post code and error message here. Please help me to figure out where the bottleneck is. Thanks a lot
# Started DB Job on xxx table. for filename in directory_name/xxx_*.sql do sqlplus -s > temp.log 2>&1 dbuser/pswd@$ORACLE_SID @$filename If [ $? = 0] then date +"%D %T: $filename successully executed." >> xxxx.log else date +"%D %T: Error executing $filename." >> xxxx.log grep "ORA-" temp.log >> xxxx.log date +"%D %T: Exiting script." >> xxxx.log mail -s 'XXXX execution: Unsuccessful. See log file for errors.' mymail@company.com<xxxx.log exit 1 fi done # Delete temp.log file rm -f temp.log mail -s " XXXX execution: Successful" mymail@company.com <xxxx.log exit 0 Last edited by duke0001; 10-16-2006 at 03:59 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
|
|
#3
|
|||
|
|||
|
Thanks for your advise. something was typo. Could you please point out the coding problem in the script. Do I need to declare a envirnment variable to point to that directory? Is there any problem in wildcard for file name?
|
|
#4
|
|||
|
|||
|
Perderabo:
You are right. "If" caused the problem. Thanks for your help. |
|||
| Google The UNIX and Linux Forums |