![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to find a file named vijay in a directory using find command | amirthraj_12 | UNIX for Dummies Questions & Answers | 6 | 10-25-2008 01:37 PM |
| Little bit weired : Find files in UNIX w/o using find or where command | jatin.jain | Shell Programming and Scripting | 10 | 09-19-2007 07:47 AM |
| help to find find filename usingFile pointer in c | arunkumar_mca | UNIX for Dummies Questions & Answers | 2 | 08-07-2007 11:23 AM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 06:38 PM |
| how to find a file in UNIX without find command? | bluo | Shell Programming and Scripting | 3 | 09-25-2003 12:47 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
using find within if RC always 0?
I am trying to use find within an if statement. Problem is, even though my find returns nothing, the RC is 0 and continues. Intent - check the log of a weekly job for successful completion. If complete, carry on. If not, tell me and exit. Suggestions? I have tried the following: Code:
if find /var/opt/logdir/* -mtime -7 -exec grep "completes" {} \;
then
crontab -l > /tmp/root_cron.$DATE
crontab -l | sed '/\/usr\/local\/bin\/job/s!^!#!' > /tmp/root_cron.new
crontab /tmp/root_cron.new
else
echo "copy job did not complete"
exit 0
fi
Results from command line: Code:
$ find /var/opt/logdir/* -mtime -7 -exec grep "completes" {} \;
$ echo $?
$ 0
$ find /var/opt/logdir/* -mtime -7
$ echo $?
$ 0
$ find /var/opt/logdir/*
/var/opt/logdir/job.log.Mon
/var/opt/logdir/job.log.Tue
/var/opt/logdir/job.log.Wed
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|