简体   繁体   English

如何使用Shell脚本从C9登录到Heroku?

[英]How to login to heroku from c9 using shell script?

Heroku provides cli commands. Heroku提供cli命令。 They have heroku login command which can be run in linux to login to heroku. 他们有heroku login命令,可以在linux中运行以登录到heroku。 After executing the command heroku login, it asks for heroku login and password using prompts. 在执行命令heroku login之后,它将使用提示询问heroku登录名和密码。 I want to login using an automated script. 我想使用自动脚本登录。

let's say I have a bash script named login.sh. 假设我有一个名为login.sh的bash脚本。

I am trying to login to heroku account from cloud9 ide when I run this script. 运行此脚本时,我试图从cloud9 ide登录到heroku帐户。 ./login.sh ./login.sh

Inside login.sh is the command 在login.sh内部是命令

heroku login

So far I have tried 到目前为止,我已经尝试过

echo -e "valid@email.com\npassword\n" | ./test.sh 

First of all, are you sure you really need an automatic heroku login script? 首先,您确定您确实需要一个自动的heroku登录脚本吗? You shouldn't need to login to heroku every time you open your cloud9 workspace. 您不需要在每次打开cloud9工作区时都登录到heroku。 Only the first time after the workspace is created / restarts. 仅在创建/重新启动工作空间之后的第一次。

If you really do need an automatic login script, one way to do it is to write a short expect script. 如果确实需要自动登录脚本,则一种方法是编写一个期望值较低的脚本。 You will probably need to do install expect in your C9 workspace. 您可能需要在C9工作区中进行expect安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM