expect 可以自动登录 ssh 和 ftp ,但是 mosh 的话我把脚本里的执行命令替换成 mosh 的登录命令会出错。
如何自动登录 mosh ???像自动登录 SSH 那样。
脚本语言不是很了解,多谢。
#!/usr/bin/expect -f
set user xxx
set host xxx
set password xxx
set port xxx
set timeout -1
spawn mosh $user@$host --ssh="ssh -p $port"
expect "*assword:*"
send "$password\r"
interact
expect eof