0
我正在嘗試從串行端口逐行讀取。下面的代碼工作,但我不斷收到一個我不明白的錯誤。任何線索?在bash腳本中讀取問題
這是代碼
while read line ; do
if [ "$(line)"=='OFF' ] ;
then
echo "that was actually OFF"
fi
done < /dev/ttyACM0
這就是錯誤:
that was actually OFF
./reading_loop.sh: line 9: line: command not found
$ line或$ {line}而不是$(line) – Ronald 2014-08-29 11:15:46
啊真的!非常感謝! – user1835630 2014-08-29 11:20:43
@Ronald爲什麼不把它作爲答案? – shadowtalker 2014-08-29 11:48:32