mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Generalize automatic login example for Linux
This commit is contained in:
parent
29546bb13a
commit
96fafc5fb4
1 changed files with 3 additions and 4 deletions
|
|
@ -13,17 +13,16 @@ local logins = {
|
|||
},
|
||||
}
|
||||
|
||||
send("\n")
|
||||
local found, match_str = expect("\\w+- login:", 10)
|
||||
if (1 == found) then
|
||||
local model = string.match(match_str, "^%w+")
|
||||
local login = logins[model]
|
||||
local hostname = string.match(match_str, "^%w+")
|
||||
local login = logins[hostname]
|
||||
if (nil ~= login) then
|
||||
send(login.username .. "\n")
|
||||
expect("Password:")
|
||||
send(login.password .. "\n")
|
||||
else
|
||||
print("\r\nDon't know login info for " .. model .. "\r\n")
|
||||
print("\r\nDon't know login info for " .. hostname .. "\r\n")
|
||||
end
|
||||
else
|
||||
print("\r\nDidn't find a login prompt\r\n")
|
||||
Loading…
Add table
Add a link
Reference in a new issue