Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 6 Dec 2001 19:26:55 +0100 From: "Gerrit P. Haase" X-Mailer: The Bat! (v1.53t) Business Reply-To: "Gerrit P. Haase" Organization: convey Information Systems GmbH X-Priority: 3 (Normal) Message-ID: <1933734840.20011206192655@familiehaase.de> To: Jorge Goncalvez CC: cygwin AT cygwin DOT com Subject: Re: Making perl script running under bash cygwin In-Reply-To: <200112061557.QAA15720@cabs40.col.bsf.alcatel.fr> References: <200112061557 DOT QAA15720 AT cabs40 DOT col DOT bsf DOT alcatel DOT fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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 DOT haase AT convey DOT 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/