Re: Making perl script running under bash cygwin

2001-12-06 Thread Gerrit P. Haase

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/




RE: Making perl script running under bash cygwin

2001-12-06 Thread Robinow, David

system returns 0. 'system(...) or die' should always die.  Does it run the
command first?
  Does this have anything to do with cygwin? i.e., does it perform
differently on other systems?

-Original Message-
From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 06, 2001 10:57 AM
To: [EMAIL PROTECTED]
Subject: RE:Making perl script running under bash cygwin


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?


--
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/