https://www.unix.com/shell-programming-and-scripting/157402-running-scripts-minicom.html
https://alioth-lists.debian.net/pipermail/minicom-devel/2008/000904.html
參考腳本 可以自動用 minicom 登入 執行
https://linux.die.net/man/1/runscript
腳本語法
用minicom 登入去控制TTY連接的系統
minicom -b 115200 -D /dev/ttyS1 -S CMD.TXT &
--------------------
CMD.TXT
------------------------
#set the global timeout
timeout 300
verbose on
# send a carriage return first to check that the login is
# correctly displayed
sleep 5
send "^C^C^C^C^C^C^C^C"
send "\n"
send "\n"
expect {
"XXX login:" break
#timeout 60 goto panic
}
#expect "enter:"
#goto login
#login:
send "abc"
expect {
"Password:" break
#timeout 60 goto panic
}
sleep 1
send "xxxxxxxx"
send echo "ifconfig" > /tmp/run.sh
send echo "ifconfig" >> /tmp/run.sh
send sleep 1
send chmod 777 /tmp/run.sh
send /tmp/run.sh
#########################
# panic subroutine #
#########################
# panic kill
panic:
! killall -15 minicom
-----------------------------------------
另外這邊有一些範例解說
http://blog.sina.cn/dpool/blog/s/blog_5d9051c00100flcu.html?md=gd
http://blog.sina.cn/dpool/blog/s/blog_5d9051c00100fmip.html
CTRL-A的ASCII是 01;
下面是一段自动打开minicom程序,并设置输入回显。
#!/usr/bin/expect
spawn minicom
expect "Press CTRL-A Z for help"
send "\01"
send "z"
send "e"
interact
留言列表