看板 Linux 關於我們 聯絡資訊
小弟想透過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
CP64: 第一 bash 變數賦值 變數和等號中間不能有空白 02/09 16:12
CP64: 然後應該沒後面了 我剛剛打太快 02/09 16:16
jack58: 感謝! 以解決! 02/09 16:35