我需要从split bash命令获取结果以在php中构建一个exec文件。
例子:
我的档案: 1
我的bash命令:
split 1 -l 10 test -a 4
现在我得到更多示例文件,例如:
testaaaa,testaaab,testaaac,
我需要结果,因为要得到该结果,我需要构建一个看起来像这样的文件:
php file.php testaaaa ;
php file.php testaaab ;
php file.php testaaac ;
...
有什么办法吗?
解决方案:
echo "[+] Start spliting...\n";
exec("split 1 -l 800 split -a 4");
exec("ls | grep split", $op);
exec("rm -rf mass");
$file = fopen('mass', 'a');
foreach(array_values($op) as $line) {
fwrite($file, 'php crawler ' . $line . ' ; ' . PHP_EOL);
}
fclose($file);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句