1. 首先在命令行尝试如下命令:
for i in {1..4098}; do echo 1; done| grep 1|head -n 2
输出:
1
1
没有任何问题
2. 使用PHP执行该命令:
1 2 3 |
<?php $cmd = "for i in {1..4098}; do echo 1; done| grep 1|head -n 2"; echo `$cmd`; |
得到结果如下:
grep: writing output: Broken pipe
grep: writing output: Broken pipe
1
1
为什么?