首页 > 解决方案 > 从命令填充的 Makefile 导出 bash 环境变量

问题描述

我正在尝试创建一个Makefile将导出由命令填充的 bash 环境变量:

RESOUCE_GROUP=containerresourcegroup
STORAGE_ACCOUNT=mycontainerstorage
SHARE_NAME=containers

do:

    AZURE_STORAGE_CONNECTION_STRING=$(shell az storage account show-connection-string --resource-group ${RESOUCE_GROUP} --name ${STORAGE_ACCOUNT} --query connectionString -o tsv)
    export AZURE_STORAGE_CONNECTION_STRING

当我运行任务时,变量未正确填充:

$ make do
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=mycontainerstorage;AccountKey=[removed]
export AZURE_STORAGE_CONNECTION_STRING

我错过了什么?

标签: bashmakefilegnu-make

解决方案


推荐阅读