shell - Expect-like functionality to IO.gets? -
for example, if wanted automate authorizing hex user. like
mix hex.user auth #!/usr/bin/expect -f  expect "username: " send -- "$hex_username\r" expect "password: " send -- "$hex_password\r" mix hex.user auth asks username: , password: don't think expect works this
given following script:
u = io.gets("username: ") |> string.strip p = io.gets("password: ") |> string.strip  io.puts "" io.puts "#{u} - #{p}" you can pass input this:
$ export hex_username="hexuser" $ export hex_password="hexpass" $ echo "$hex_username\n$hex_password" | elixir test.exs username: password: hexuser - hexpass so, use
echo "$hex_username\n$hex_password" | mix hex.user auth 
Comments
Post a Comment