作者jack58 (有信心)
看板AndroidDev
标题[问题] android下 shell script 抓关键字问题
时间Thu Feb 9 16:10:57 2017
小弟想透过shell script抓kernel log中的一些关键字
像是下面一小串kernel log
<6>[ 2731.456308] xxx_handler_work -- wdg_val:0
<6>[ 2731.461548] xxx_do_hotword_work -- send hotword uevent!
<7>[ 2731.471493] cpu-tegra: force EDP limit 2014500 kHz
<4>[ 2734.430346] xxx_dsp_core_reset_put(684)dsp core reset:0
我用的shell script语法是
result =`dmesg | grep -c wdg_val`
理论上透过$result应该可以得到 1 这个数字
但是系统却回应我
watchdog_test.sh[24]: result: not found
watchdog_test.sh[24]: [: 1: unexpected operator/operand
我是不是漏了什麽?
请教各位大大, 麻烦各位了, thanks
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.250.205.229
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1486627861.A.100.html
1F:推 dododavid006: 等号两边不能有空白 其实这问题去 Linux 版问会好点 02/09 22:05