This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Making perl script running under bash cygwin
- From: "Gerrit P. Haase" <freeweb at nyckelpiga dot de>
- To: Jorge Goncalvez <goncal11 at col dot bsf dot alcatel dot fr>
- Cc: cygwin at cygwin dot com
- Date: Thu, 6 Dec 2001 19:26:55 +0100
- Subject: Re: Making perl script running under bash cygwin
- Organization: convey Information Systems GmbH
- References: <200112061557.QAA15720@cabs40.col.bsf.alcatel.fr>
- Reply-to: "Gerrit P. Haase" <freeweb at nyckelpiga dot de>
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
gerrit.haase@convey.de 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/