php exec()某个shell结果出错
来源:互联网 发布:数据远传系统 编辑:程序博客网 时间:2024/05/22 15:38
原因是php中的 grep只能处理文本流,二进制流不行.
cat aa.txt | grep 'startup' |wc-l
在linux命令行下测试没有问题。但是在php的exec的就出现问题了,很奇怪。
结果报错:
报错提示如下:cat: write error: Broken pipe
废了好大劲,终于解决。
grep的选项增加-a选项就ok了
grep -a选项的意思是:Process a binary file as if it were text; this is equivalent to the --binary-files=text option
应该是cat的这个文件内容有二进制流,导致grep不识别
- php exec()某个shell结果出错
- php 获取 exec 的输出结果
- php执行shell命令,system、exec、passthru
- Defaults visiblepw php exec sudo shell 脚本
- php 返回查询结果某个字段
- shell-exec
- php通过exec调用shell命令导致乱码问题
- php 用exec执行shell命令时超时。
- php exec()
- window WScript.Shell.run使用try.catch取不到出错信息要换用exec
- exec运行shell语句
- shell中exec解析
- shell中的exec
- shell中exec命令
- MongoDB exec Shell
- shell中exec解析
- shell中exec解析
- shell中exec解析
- LPC2138 startup.s
- HDU 3592 World Exhibition 差分约束
- strace命令用法详解
- 跨域的几种方法
- Spring MVC 教程,快速入门,深入分析
- php exec()某个shell结果出错
- Problem4
- vs2003网站项目加载失败解决方案
- 项目四--动态链接初试
- JS中定义对象方式五: 使用动态原型方式创建对象
- Delphi-Scrollbar控件的使用方法和详解
- uva10422 - Knights in FEN
- Java对XML的读写操作类
- 开源代码网站