bash - 如何在 bash 脚本中运行这两个 heroku 命令?

标签 bash heroku

我想在 bash 脚本中运行一些 heroku 命令。我知道这完全不对,应该参加 bash 类(class),但以下是我想要完成的。

# get the database url and assign it to a variable
URL=heroku config:get DATABASE_URL -a wt2-production

# insert the variable in another command
heroku pg:copy URL DATABASE_URL --app my-staging-app

我如何在 bash 脚本中完成此操作?

最佳答案

您可以使用 $(command expansion)"$variable_expansion" 执行此操作:

# get the database url and assign it to a variable
URL=$(heroku config:get DATABASE_URL -a wt2-production)

# insert the variable in another command
heroku pg:copy "$URL" DATABASE_URL --app my-staging-app

关于bash - 如何在 bash 脚本中运行这两个 heroku 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35208841/

相关文章:

ruby-on-rails - 如何从 Heroku 检索 git 存储库?

bash - 如何修改以下 ps 命令以以逗号分隔值 (CSV) 格式打印?

linux - 如何使用存储在单个变量中的引号传递命令行参数?

bash - 带有 SSH 的 git clone 只能在 Git Bash 中工作,不能在 Windows CMD 上工作

bash - 如何获取内置命令的内置?

ruby-on-rails - 推送到 Heroku 时出现 Assets 错误

python - 如何在 GitHub 源 (Python) 上向 Heroku 添加我不想要的 secret 文件

python - 使用 Foreman 进行 Flask 日志记录

postgresql - 数据库连接在Golang中出错了吗?

bash - Git bash | bash : sudo: command not found (and others)