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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -