schms wrote:
I am trying to run the following system() command. It seems as Perl is
not able to handover $POLICYNAME
to the Unix shell

It *looks* like you are trying to hand over $POLICYNAME to /usr/openv/netbackup/bin/admincmd/bpplinfo and not to the shell.

Whether or not system() invokes a shell to run your command depends on the presence of shell meta-characters and/or the version of Perl that you are running.


and that the shell gets a problem with the strings -
modify and -inactive as they contain a minus (-). Is there a way to
run the command

On the command line you would put -- just after the command to indicate that everything following are not switches.


/usr/openv/netbackup/bin/admincmd/bpplinfo $POLICYNAME -modify -
inactive

from a Perl script ?


(..)

open(RDME, "$COMMAND |") or die "Error in: $!\n";

open RDME, '-|', $COMMAND or die "Error in '$COMMAND' $!\n";


while (<RDME>) {
        my $POLICYNAME = $_;

while ( my $POLICYNAME = <RDME> ) {
    chomp $POLICYNAME;


        my @args = ("/usr/openv/netbackup/bin/admincmd/bpplinfo
$POLICYNAME -modify -inactive");
        system(@args);

my @args = ( '/usr/openv/netbackup/bin/admincmd/bpplinfo', $POLICYNAME, '-modify', '-inactive' );

    0 == system @args or die "system @args failed: $?";


}

close(RDME);

close RDME
    or warn $! ? "Error closing '$COMMAND' pipe: $!"
               : "Exit status $? from '$COMMAND'";



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to