zoukankan      html  css  js  c++  java
  • [Android]Recovery调用外部Shell脚本,Shell脚本使用ui_print方法

    busybox_bin=/sbin/busybox
    
    # 获取PIPE
    get_outfd(){
        if $busybox_bin ls -l /proc/self/fd/21 | $busybox_bin grep -q 'pipe'; then
            echo 21
        else
            local all_pipe_file=/tmp/all_pipe_file.txt
            $busybox_bin ls -l /proc/self/fd/ > $all_pipe_file
            $busybox_bin grep 'pipe:' $all_pipe_file | $busybox_bin awk '{print $9}'
        fi
    }
    
    OUTFD=$(get_outfd)
    
    # 打印日志
    ui_print(){
        if $busybox_bin test -n $OUTFD;then 
            echo -n -e "ui_print $1
    " > /proc/self/fd/$OUTFD
            echo -n -e "ui_print
    " > /proc/self/fd/$OUTFD
        fi
    }
    
    ui_print "Iam here!!!"

    在Shell脚本中可以使用ui_print可以方便调试Recovery环境运行的Shell脚本,也可以向用户提供关键的日志信息

  • 相关阅读:
    rabbitmqctl常用命令-3
    Count and Say
    Spiral Matrix II
    Minimum Path Sum
    Plus One
    Rotate Image
    Permutations
    Search a 2D Matrix
    Binary Tree Level Order Traversal II
    Binary Tree Level Order Traversal
  • 原文地址:https://www.cnblogs.com/scue/p/4381821.html
Copyright © 2011-2022 走看看