sudo minicom
ctrl+A   再按O
设置参数,然后保存为minirc.dfl
最后文件在~/.minirc.dfl


1. 用法
  minicom -S <script name> -C <log name>
  参数解析:
  -S: 指定要执行的脚本
  -C: 指定输出日志文件名

minicom配置文件minirc.dfl

pu port             /dev/ttyUSB2
pu rtscts           No
pu baudrate         115200
pu bits             8
pu parity           N
pu stopbits         1
pu xonxoff          No

minicom的脚本sim7600minicom.txt如下

timeout 300
verbose on
sleep 1

send "AT"
expect {
    "OK" break
}
sleep 1
send "AT+CNMP=38"
expect {
    "OK" break
}
sleep 1
send "AT$QCRMCALL=1,1"
expect {
      "$QCRMCALL: 1, V4" break
      }

命令示例脚本

#!/bin/bash

sudo minicom -S /home/ubuntu/python/0916/sim7600minicom.txt -C /home/ubuntu/python/0916/output.txt &

sudo kill -15 $(ps -ef|grep minicom|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')

参考连接:

kill后面数字的含义 http://blog.itpub.net/12474069/viewspace-622446/