Macbook校园网只能用第三方inode来验证,但是只要一直下载过一会就就会断开需要重新验证
于是搜索了半天看到了expect语言。便想到如何用这个语言编一个断网自动重连。无奈编了半天老是提示错误。
#!/usr/bin/expect
set password ********
cd /Users/*****/***
spawn sudo ./i.sh start
set timeout -1
while {
if {$expect_out "Password"}{
send--{$password}}
if {$expect_out "Got EAP Request for Identity"}{
sleep 10}
if {$expect_out "EAP Failure"}{
spawn sudo ./i.sh start}else{
}
}
exit