akechnie has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use the following command to find any of the following files ending in '.file'. $sethost just refers to a variable containing a host name that will be ssh'd to. ----- $gziplogs = `$sethost "find /var/log/tmp/ -iname '*.file' -type f -exec ls -hl \{\} \;"`; ----- When I run in I keep getting: find: missing argument to `-exec' Any assistance would be greatly appreciated!

Replies are listed 'Best First'.
Re: Assistance using the find command
by Khen1950fx (Canon) on Dec 23, 2010 at 06:09 UTC
    To find any of the files ending in .log in /var/log:
    #!/usr/bin/perl use strict; use warnings; use File::Find::Wanted; my @files = find_wanted( sub { -f && /\.log$/ }, '/var/log' ); if (@files) { foreach my $file(@files) { print $file, "\n"; } } else { print "Sorry. Could not find requested files\n"; }
Re: Assistance using the find command
by Anonymous Monk on Dec 23, 2010 at 04:30 UTC
    Try
    my $cmd = q!$sethost "find /var/log/tmp/ -iname '*.file' -type f -exec + ls -hl \{\} \;!; print "Trying to run\n$cmd\n"; print qx!$cmd!;
    that should clear up the issue for you
      hrm have a feeling that won't work unless I close the " somewhere. But is that all one command excluding the print statements. All I can see that's different is removing the ` and adding q!