阅读背景:

Grep not working in script but on console

来源:互联网 

I have a problem with a script. I have a voltage meter connected to a serial USB device(ttyUSB1). The smart meter needs an initial sequence and shortly followed by a second command to give all of it's information. That works fine. 1.8.0*00(000898.46) for example comes in this is the line I am interested in. The number in brackets is the kWh number i want. If i open a second terminal and do a cat /dev/ttyUSB1 it works fine and i can see the information coming in. After 4 to 5 seconds the line I want comes in. But the script is not working. If i start a script in one terminal it keeps waiting. Grep is not finishing. If I start it in a second terminal then the first terminal gets finished. Or just the grep 1.8.0 /dev/ttyUSB1 -m1 in another terminal works but not in the script. I tried different methos with read and so none worked. To be honest i don't understand much of scripting and always succeed somehow but here nothings helped :(I have a problem with a script. I have a voltag




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: