![]() |
|
|
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 |
| Can BASH execute commands on a remote server when the commands are embedded in shell | bash_in_my_head | Shell Programming and Scripting | 1 | 12-04-2008 01:51 AM |
| lom don't execute commands | pasalagua | SUN Solaris | 6 | 01-25-2008 04:22 PM |
| How to execute multiple commands via ssh | srage | Shell Programming and Scripting | 9 | 01-05-2008 03:18 AM |
| Can Xargs execute multiple commands of evry input file | nilesrex | Shell Programming and Scripting | 4 | 08-30-2006 09:39 AM |
| how do i get my script to execute multiple commands? | hvincent | Shell Programming and Scripting | 1 | 04-26-2006 09:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Execute multiple commands in a find
I am checking that a file is older than a reference file that I build with a touch command before processing it. If it is not old enough, I want to sleep for an hour and check again. My problem is if it is old enough to process, I want to exit when I am done, but I cannot find a way to exit after doing a successful find. It keeps looping and processing until the count is fulfilled. I have tried doing an exit as a -exec on the find as shown below and I have tried checking the status of the find with $?, but it is always "0" whether the file is old or new. Any ideas? Code:
typeset -i count=1
while ((${count} <= 3))
do
find /export/home/MYACCT/ -type f -name \ar5.log ! -newer /WORKDIR/REF -exec /export/home/MYACCT/datetest.ksh \; -exec exit 0 \;
count=${count}+1
sleep 3600
done
echo "No file to process"
exit 5
|
|
||||
|
Thanks
Thanks Padow, that worked great. Code:
abc=`find /export/home/MYACCT/ -type f -name \ar5.log ! -newer /WORKDIR/REF`
if [ -z "$abc" ]; then
count=${count}+1
sleep 3600
else
/export/home/MYACCT/datetest.ksh
exit 0
fi
done
echo "No file to process"
exit 5
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|