Hallo Jorge,

2001-12-06 19:22:29, du schriebst:

> Hi, I have this :
> system("perl -i.orig -pe 's!/home/ftp!/!g' c:/cygwin/etc/passwd") or die;

> And it dies always althought it works if I run it by Hand in the cygwin bash.
> Why?

Cannot say the exact raeson, but i left out the 'or die' and it works.
#!/usr/bin/perl

$args = "perl -i.orig -pe \'s!/home/ftp!/!g\' /etc/passwd";
system($args);

Maybe some native english speaker has a better understanding of this
part of perlrun.pod:

       -p   causes Perl to assume the following loop around your
            program, which makes it iterate over filename argu­
            ments somewhat like sed:

              LINE:
                while (<>) {
                    ...             # your program goes here
                } continue {
                    print or die "-p destination: $!\n";
                }

            If a file named by an argument cannot be opened for
            some reason, Perl warns you about it, and moves on to
            the next file.  Note that the lines are printed auto­
            matically.  An error occurring during printing is
            treated as fatal.  To suppress printing use the -n
            switch.  A -p overrides a -n switch.

            "BEGIN" and "END" blocks may be used to capture con­
            trol before or after the implicit loop, just as in
            awk.

Gerrit
-- 
convey Information Systems GmbH                   http://www.convey.de/
                                                  Vitalisstraße 326-328
Gerrit P. Haase                                   D-50933 Köln
[EMAIL PROTECTED]                            Fon: ++49 221 6903922


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to