![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Find command with prune and exec options | Sebarry | UNIX for Dummies Questions & Answers | 2 | 06-19-2006 04:07 AM |
| Find command with prune and exec | Sebarry | UNIX for Advanced & Expert Users | 1 | 06-18-2006 01:43 PM |
| find command exec error | pavan_test | UNIX for Dummies Questions & Answers | 2 | 06-13-2006 03:58 AM |
| ls command doesnt work | shawnbishop | HP-UX | 2 | 09-01-2005 09:57 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
find command with exec doesnt work
Hi There,
I have a script which finds for log files and removes them if the file has changed in the last day. The script runs fine without errors. The log file is still there. So, I decided to print the find command and run the command outside the script. Getting "Incomplete statement" Can you give any ideas? Thank you. Unix fan. Script ***** #!/bin/ksh log_home="/export/home/n74915/" set -x typeset -i10 days_old=${3:-1} jobid="$1" print $jobid print "Cleaning up" print $(print $jobid)'t.log' find $log_home -type f -name $(print $jobid)'t.log' -ctime +$days_old -exec rm {} \; #remove outdated log files print $? print find $log_home -type f -name $(print $jobid)'t.log' -ctime +$days_old -exec rm {} \; #remove outdated log files print $? print "Cleaned up" |
|
||||
|
Hi,
Thank you for getting back to me. Jobid doesnt have embedded spaces in it. I tried the command upto -ctime +1 and didnt get any errors. Its only when I include -exec rm {}\; that I get incomplete statement error. the parameter is not getting passed to rm command ? Appreciate your help.. |
|
||||
|
lost in space
Code:
-exec rm {}\;
between the last close-curly and the backslash. "Incomplete statement" is find telling you that it needs something to terminate the -exec clause. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|