android - 在 bash 脚本中退出 adb shell logcat

标签 android bash logcat

当我运行以下脚本时,它在中断后挂起,因此永远不会执行“做其他事情”。我怀疑这是因为在中断之后,adb shell logcat仍在执行。手动按 ctrl-c 会终止 logcat 并允许执行其他操作,但有没有办法自动执行此操作?

adb logcat -c
adb shell logcat -s "test" | while IFS=" " read -a Array
do
    echo "${Array[2]} ${Array[3]}" 
    if [ "${Array[2]}" == "${Array[3]}" ]
    then echo "Equals"
        break
    fi
done
#do something else

谢谢

最佳答案

我最终使用的解决方案是以下解决方案的变体:

Find and kill a process in one line using bash and regex

关于android - 在 bash 脚本中退出 adb shell logcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16696603/

相关文章:

java - 表格布局问题

android - 为什么我的 Firebase 字符串不会显示在 myRecyclerView 上

android - 我的应用程序无法显示任何日志

Android AsyncTask 进程 (logcat) 不输出消息(在模拟器上)

android - 删除doOnTextChanged上的文本会删除我以编程方式设置的编辑文本的特殊格式

java - 设置土耳其语和英语语言环境 : translate Turkish characters to Latin equivalents

bash - 如何按原样打印 bash 脚本中的输入参数

linux - set -e 覆盖bash脚本中的参数变量($@)

regex - 使用 grep 更改过滤字符串中的结果

android - 以编程方式读取应用程序的 logcat