ADB shell script to send AT commands to a modem-cannot return control to a shell and capture output

[亡魂溺海] 提交于 2019-12-01 11:46:45

I suggest that you try out my atinout program which should be exactly what you are asking for: a program to send AT commands from the command line and capture the output.

In your case the result should be like

$ echo 'at+cops?' | atinout - /dev/pts/7 -
+COPS: 0,0,"AT&T",6

OK
$

and to capture the output just put a file name instead of the last -.

I had similar problems with redirecting output to file. I resolved my problem by adding CMD /c in front of the echo command. I.e. if I understand correctly you need to tell the system that it needs to wait until command finishes executing and only then redirect output to a file. I was doing it in DOS.

Since you are running on ANDROID try adding sh -c in front of your command. Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!