mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add automatic login script example
This commit is contained in:
parent
a1987b61b4
commit
f4c4387e05
1 changed files with 28 additions and 0 deletions
28
examples/lua/automatic-login.lua
Normal file
28
examples/lua/automatic-login.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local logins = {
|
||||
{
|
||||
serialnumber = "foo",
|
||||
username = "foouser",
|
||||
password = "foopass",
|
||||
},
|
||||
{
|
||||
serialnumber = "bar",
|
||||
username = "baruser",
|
||||
password = "barpass",
|
||||
},
|
||||
{
|
||||
serialnumber = "baz",
|
||||
username = "bazuser",
|
||||
password = "bazpass",
|
||||
},
|
||||
}
|
||||
|
||||
for _, login in ipairs(logins) do
|
||||
send("\n")
|
||||
local found = expect(login.serialnumber .. ".*login:", 10)
|
||||
if (1 == found) then
|
||||
send(login.username .. "\n")
|
||||
expect("Password:")
|
||||
send(login.password .. "\n")
|
||||
break
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue