System commands return zero for true, some other value for failure.
This is backwards from perl's logic.  You need to test for a return of
zero, or use "and" instead of "or" like this:

 if ((system("system command")) == 0) { success }
  or
 system("system command") and die "$!\n"; # AND says "Did I get a
non-zero?"

I prefer the first because it's easier to understand - especially if
somebody else ever has to look at your code.

And I suggest doing it on every system command (verifying the return
value, that is).  Better yet, see if you can do it from within perl
first.

Good Luck!
Matt

-----Original Message-----
From: insomniak [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 9:44 AM
To: [EMAIL PROTECTED]
Subject: using system?


Hi,
What is the best way to find out if a command is suceesful/finished when
using system(); Im trying things like die if system("some command"); or
warn if system("some command");
 - not really worried about why it fails only if it fails and when it
has finished This works but.... I would like to be able to run the next
system command only after the first has finished. I read that this could
be somthing to do with wait() but I cannot find any exmaple to work
from. Any help is much appreciated.

Regards
Mark Kneen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to