大家好,我需要捕获外部命令的输出,因此我使用反引号。但是,当命令到达换行符时,将省略输出。其中 $_ = AD
@lines = `"C:/Program Files/Veritas/NetBackup/bin/admincmd/bppllist" $_ -U"`
测试:test1 测试:test2 测试:test3 测试:test4
实际输出:@lines
测试:test1 测试:test2
感谢您的时间。
print HTML "<h2 id='pol'>Policy Configuration\n</h2>" ;
@bpllist =`"$admincmd/bppllist.exe"` or die print "$admincmd/bppllist.exe not found or could not be executed";
foreach (@bpllist)
{
print HTML "<div><table class='table'>\n";
@lines = `"$admincmd/bppllist" $_ -U` or die print "$admincmd/bpplinfo $_ -U not found or could not be executed";
print HTML "\t<tr>\n\t<td><b>Policy name: <b></td><td>$_</td>\n\t</tr>\n" ;
foreach (@lines) {
chop;
($var, $value) = split(/:/,$_,2);
$var = "" if !defined($var);
$value = "" if !defined($value);
print HTML "\t<tr>\n\t<td>$var</td><td>$value</td>\n\t</tr>\n" ;
}
print HTML "</table></div>";
}
@bpllist 的输出:
AD
Sharepoint
Echchange
Vmware