C
carlisle411
I've mocked up a simplified version of my problem. In it, I'm trying
to determine the result of my tar command - was it successful?. I have
to use the "command |" syntax to invoke the command. All my normal
channels for finding the solution have come up dry. Thoughts? Thanks.
-j
--------------------------------------
$ ./test.pl
tar: filethatdoesnotexist: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
TAR was successful
$
-----------test.pl---------------------------
#!/usr/bin/perl
use strict;
my $command = "tar -czv -f whatever.tar.gz filethatdoesnotexist";
eval
{
open COMMAND, "$command|";
while (<COMMAND>)
{
print;
}
close COMMAND;
};
if ( $@ )
{
print "!! TAR Failed !!\n";
return -1;
}
else
{
print "TAR was successful\n";
}
to determine the result of my tar command - was it successful?. I have
to use the "command |" syntax to invoke the command. All my normal
channels for finding the solution have come up dry. Thoughts? Thanks.
-j
--------------------------------------
$ ./test.pl
tar: filethatdoesnotexist: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
TAR was successful
$
-----------test.pl---------------------------
#!/usr/bin/perl
use strict;
my $command = "tar -czv -f whatever.tar.gz filethatdoesnotexist";
eval
{
open COMMAND, "$command|";
while (<COMMAND>)
{
print;
}
close COMMAND;
};
if ( $@ )
{
print "!! TAR Failed !!\n";
return -1;
}
else
{
print "TAR was successful\n";
}