Fouled Script
SoloCDM
deedsmis at aculink.net
Tue Jan 8 05:24:07 CST 2002
Eric Schwartz stated the following:
>
> On Mon, Jan 07, 2002 at 12:25:24AM -0700, SoloCDM wrote:
>
> > The attached script is my first attempt at some means of perl
> > scripting, base on your advice. It won't work. I keep getting the
> > following error:
>
> > syntax error at ./find-perl-sample2 line 8, near "open " Execution
> > of ./find-perl-sample2 aborted due to compilation errors.
>
> Unquoted string "directory" may clash with future reserved word at
> find-perl-sample line 4. Scalar found where operator expected at
> find-perl-sample line 5, near "$MFILES" (Missing semicolon on previous
> line?) syntax error at find-perl-sample line 5, near "$MFILES "
> find-perl-sample had compilation errors.
>
> Essentially, you're missing a bunch of semicolons, and if [directory]
> isn't what you really put there, you should tell us, so we know
> what you actually are asking about. Otherwise, you should quote it
> properly. Furthermore, by using [directory], you're creating an
> arrayref, and I don't think that's what you wanted to do there.
Now I am getting the error below with the attached file:
sh: -c: line 1: syntax error near unexpected token `('
sh: -c: line 1: `find / -type f -ls -xdev -fstype ext2 ( -iname
'*personal*' -o -iname '.*personal*' ) -print'
I hope all the semicolons are in place; although, previously to
sending the first posting -- I put all the semicolons as expected, but
I still didn't get a correct response from the script.
--
Note: When you reply to this message, please include the mailing
list/newsgroup address and my email address in To:.
*********************************************************************
Signed,
SoloCDM
-------------- next part --------------
#!/usr/bin/perl -w
#
$MDIR = "/";
$MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print";
open FIND, "$MFILES |" or die $!;
while( <FIND> ) {
# $_ will have each file name found with full path name
# do what you want with it here
print "$_\n";
}
close FIND;
More information about the Pikes-peak-pm
mailing list