且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Shell脚本中使用AT命令

更新时间:2023-12-05 21:06:16

暂时 1 我认为您***的选择是使用编程语言

For the time being1 I think your best option here is to use the programming language expect. It is written to monitor growing text output and support scenarios like

  1. 等待字符串"Username:"出现在输出中.
  2. 发送字符串"my_name".
  3. 等待字符串"Password:"出现在输出中.
  4. 发送字符串"my_secret_password".
  1. Wait for the string "Username:" to appear in the output.
  2. Send the string "my_name".
  3. Wait for the string "Password:" to appear in the output.
  4. Send the string "my_secret_password".

发送AT命令并等待响应非常相似,因此这是绝对可行的.当我在爱立信工作时,我们编写了一个测试套件,期望它可以发送AT命令并解析日志文件以运行测试.

Sending AT command and waiting for the response is very similar, so this is absolutely doable. When I worked at Ericsson we had a test suite written in expect that sent AT commands and parsed log files to run tests.

1 作为我的 atinout 程序的伴侣,我已经开始编写一个程序来发送命令AT + CMGS及其有效载荷正确.但是除非您非常非常有耐心,否则您不应该等待此操作完成.

1 As a companion to my atinout program, I have started to write a program to send the command AT+CMGS and its payload correctly. But unless you are very, very patient you should not wait for this to be finished.