backticks and Veritas Netbackup commands

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm trying to write a very simple script to print the output of
bpplinfo <policyname> -L
for every Netbackup Policy at once. (I'll modify it to do more later.)

#!/usr/bin/perl -w
$BPPLLIST = "/opt/openv/netbackup/bin/admincmd/bppllist";
$TEMPPOLICYFILE = "/tmp/tmppol.out";

open ( POLFILE , $TEMPPOLICYFILE ) || die "couldnt open tmppol.out";
while ( <POLFILE> ) {
my $BPPLINFO = (`/opt/openv/netbackup/bin/admincmd/bpplinfo $_ -L `;
print @INFO;
`rm /tmp/tmppol.out`;

The problem is in the

$BPPLINFO = `/opt/openv/netbackup/bin/admincmd/bpplinfo $_ -L `

Whether I do this in the backticks, or in a roundabout fashion with the
system function, the command still fails because Veritas wrote its
utilities with the bizarre requirement to put the option flag AFTER the
arguement. When I run it I see the failed output just as if I had run
from the shell:

# bpplinfo POLICYNAME ; -L

I don't understand Perl super-well, but apparently the backticks and
system function both try to execute the -L separatelly from the
bpplinfo POLICYNAME.

Can anyone help me get around this?

Re: backticks and Veritas Netbackup commands

Brian W wrote:

Quoted text here. Click to load it

Possilbly even more like

# bpplinfo POLICYNAME
# -L

i.e. with a newline between rather than semicolon.

Quoted text here. Click to load it

Yes, that how shell treats newline characters.

Quoted text here. Click to load it

Strip the newline character from the end of the string in $_.

This is what the Perl command chomp is for.

Site Timeline