通过bash脚本登录到Heroku [英] Log in to Heroku via bash script
问题描述
我尝试编写一个脚本,在其中我从heroku工具栏中调用一些命令.在我登录到heroku工具栏之前,脚本可以正常工作.当我尝试在脚本执行期间添加heroku的login命令时,出现了一些问题-heroku toolbelt命令中没有诸如(带有参数的命令)这样的命令:
I try to write a script in which I call some command from heroku toolbelt. Script works fine till I am login to heroku toolbelt. When I've tried to add heroku's login command during script execution I occured some problems - there is no in heroku toolbelt command such as (command with parameters):
heroku login -u email@mail.com -p 1234qwer
这就是为什么我不知道如何在bash脚本中执行heroku登录命令的原因.有人有建议吗?
That why I have no idea how to execute heroku login command in bash script. Has anyone got some advice?
推荐答案
对于这些我期望使用的东西.
For these kinds of things I use expect.
您需要先安装 expect
.如果您使用的是Ubuntu,请运行 sudo apt-get install Expect
You need to install expect
first. If you're on Ubuntu run sudo apt-get install expect
然后在脚本中,将其命名为heroku_login.exp,并在其中输入相关信息:
Then in a script, let's call it heroku_login.exp, enter this with the relevant information:
#!/usr/bin/expect
spawn heroku "login"
expect "Email:"
send "YOUREMAIL";
send "\r"
expect "Password (typing will be hidden):"
send "YOURPASSWORD"
send "\r"
interact
然后运行 expect heroku_login.exp
,您应该会很好.
Then run expect heroku_login.exp
and you should be good to go.
这篇关于通过bash脚本登录到Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!