我在编写一个脚本来启动我的 forticlient vpn 命令行客户端并在出现提示时发送我的密码时遇到一些问题。这是我的代码:
#!/usr/bin/expect -f
set loadme "./forticlientsslvpncli --server myvpnserver --vpnuser theuser
eval spawn $loadme
expect "Password for VPN: "
send "password\r"
但是,它仍然提示输入 VPN 密码。我确信这很简单,而且我对 Linux 脚本编写还很陌生,但是任何帮助将不胜感激!
Thanks!
#!/usr/bin/expect -f
set timeout -1
cd /usr/local/forticlientsslvpn
spawn ./forticlientsslvpn_cli --server myhost:10443 --vpnuser myuser
expect "Password for VPN:" {send -- "mypassword\r"}
expect "to this server? (Y/N)\r" {send -- "y\r"}
expect eof
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)