例如,如果我想自动授权十六进制用户。像
这样的东西mix hex.user auth
#!/usr/bin/expect -f
expect "Username: "
send -- "$HEX_USERNAME\r"
expect "Password: "
send -- "$HEX_PASSWORD\r"
混合hex.user auth请求用户名:和密码:但我认为期望不适用于此
答案 0 :(得分:4)
给出以下脚本:
u = IO.gets("Username: ") |> String.strip
p = IO.gets("Password: ") |> String.strip
IO.puts ""
IO.puts "#{u} - #{p}"
您可以传递这样的输入:
$ export HEX_USERNAME="hexuser"
$ export HEX_PASSWORD="hexpass"
$ echo "$HEX_USERNAME\n$HEX_PASSWORD" | elixir test.exs
Username: Password:
hexuser - hexpass
所以,你可以使用
echo "$HEX_USERNAME\n$HEX_PASSWORD" | mix hex.user auth