At 11:32 AM 5/16/01 -0600, Scott Burks wrote:
>I have a script that has the following two lines:
>
>system("echo find /OPERATIONS/system_cleanup/logs -name \"'log.*'\"
>-mtime +30 -exec rm {} '\\;' '>> $log_file 2>&1'");
>
>system("find /OPERATIONS/system_cleanup/logs -name \"'log.*'\" -mtime
>+30 -exec rm {} '\\;' '>> $log_file 2>&1'");
>
>
>The first line to echo the command to the screen which gives me the
>output of:
>
>find /OPERATIONS/system_cleanup/logs -name log.* -mtime +30 -exec rm {}
>\; >> /OPERATIONS/system_cleanup/logs/test_log_conv.051601 2>&1
>
>The second line to actually execute the command which then errs out
>with:
>
>find: -exec not terminated with ';'
>
>
>If I execute the line at the command line, it works, but from within the
>script, I get the error.
>
>
>Can anyone tell me what I have wrong.
You've got single quotes in there which are stripped out by echo but not by
find. Change it to
system("find /OPERATIONS/system_cleanup/logs -name \"log.*\" -mtime
+30 -exec rm {} \\; >> $log_file 2>&1");
That look better? Try using the qq operator to make it look even better:
system qq(find /OPERATIONS/system_cleanup/logs -name "log.*" -mtime
+30 -exec rm {} \\; >> $log_file 2>&1);
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com