![]() |
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 |
| Ftp code in Perl | Raynon | Shell Programming and Scripting | 21 | 09-11-2008 03:44 AM |
| need help to write perl code | getdpg | Shell Programming and Scripting | 0 | 09-20-2006 09:24 AM |
| perl code help | circleW | UNIX for Dummies Questions & Answers | 1 | 11-09-2004 05:28 PM |
| Perl running C code | gdboling | Shell Programming and Scripting | 1 | 09-02-2003 06:43 PM |
| Perl Code Hiding | sskb | Shell Programming and Scripting | 5 | 01-02-2002 02:21 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
PERL Code
I have a code block ...
$cmd = "find $audit_dir -mtime +$days_to_keep -exec rm {} \\;"; unless(open(CMD, "$cmd |")){ $msg = "Error command : $cmd \n\n"; print_log $lgh,"$msg",1; exit 1; } print_log $lgh, "Deleting physical files with Command : $cmd ", 1 if verbose; while ($line=<CMD>) { print_log $lgh, "Physical files older than $days_to_keep deleted from $audit_dir", 1 if $verbose; } after it executes the print_log , it's not going inside the while loop .. what am I missing here ? Thanks |
|
||||
|
If the find command doesn't print anything, you obviously won't be getting any input on the <CMD> handle. (Why would you want to print the log message once per output line if there were many lines of output, anyway?)
I guess you're trying to divine the exit status of the find command; the close should tell you that, or simply use system instead of open |
| Sponsored Links | ||
|
|