gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 09:27:42 25 4
gpt4 key购买 nike

我想在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com