日期:2014-05-17  浏览次数:20709 次

java 执行shell 脚本 返回 find的内容~~
如题:

     java 执行shell 脚本 返回 find的内容~~

 

    find.sh 内容为:

    #!/bin/sh

    source /etc/profile;

    find . -name "*2013-04-14*" |xargs grep cn="123@qq.com"


   直接执行脚本,可以打印出数据。但是在JAVA代码中:

    Process  child=Runtime.getRuntime().exec(pathshell+"/find.sh");

    final InputStream inputStream = child.getInputStream();
    final BufferedReader brOut = new BufferedReader(new InputStreamReader(inputStream));

    却没有内容~~  这是为什么?要怎么才能把find 的内容获取到呢???
java shell find 返回数据 脚本

------解决方案--------------------
加入页面阻塞,试试。例如在页面中 加入sleep