[問題] shell script 抓關鍵字問題
小弟想透過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://www.ptt.cc/bbs/Linux/M.1486626592.A.D7B.html
→
02/09 16:12, , 1F
02/09 16:12, 1F
→
02/09 16:16, , 2F
02/09 16:16, 2F
→
02/09 16:35, , 3F
02/09 16:35, 3F
Linux 近期熱門文章
21
56
PTT數位生活區 即時熱門文章