On 5 Jul 2006 at 23:12, BenBart wrote: > Is there another option of running an OS command or UNIX script besides > using system "[OS_COMMAND]", for example system "cat /etc/hosts" or > system "[UNIX_SCRIPT]"?
Yes, as you already know: exec, folk and there's the backtick operator `. > How can I make sure that the system '[OS_COMMAND]" finishes its run > before I proceed to run the rest of the codes in the script? The next line of the script will not run until system has returned. So I guess the next line of the script should check the status of what was returned from system ($! or $?, see perlvar) So something like this would return (on a *NIX system) all the running processes with the same name as your program. use strict; use warnings; my $cmd = "/bin/ps -ef|grep $0"; # see perlvar for $0. my $output = `$cmd`; Also see perlfaq8. HTH. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
