Azure CLI 运行 windows 上的 .sh 脚本
Azure CLI running .sh script on windows
是否可以在 windows 命令行中从 Azure-CLI
运行 .sh 文件。
以下是我正在尝试 运行 在本地 Azure-CLI
上的 cosmosDB
集合创建脚本
#!/bin/bash
# Set variables for the new account, database, and collection
resourceGroupName='testgropu'
location='testlocation'
accountName='testaccount'
databaseName='testDB'
prefix='prefix.'
tenantName='testTenant'
collectionTest='.test'
originalThroughput=400
newThroughput=500
az cosmosdb collection create \
--resource-group $resourceGroupName \
--collection-name "$prefix$tenantName$collectionTest" \
--name $accountName \
--db-name $databaseName \
--partition-key-path "/'$v'/testId/'$v'"
是否可以 运行 这些命令作为来自 Azure-CLI 的脚本,如 linux . test.sh
?
实际上,您不能像 Linux . test.sh
那样 运行 bash 脚本。但是,如果您像这样在 windows 中安装 WSL,则可以 运行 命令提示符中的 bash 脚本:
bash test.sh
此外,如果您没有在 windows 中安装 WSL,则 bash
不会被识别为内部或外部命令。而且您也不能在 PowerShell 中使用 bash
命令。
注意:在windows中创建bash脚本时要注意,[=25]之间的字符不同=] 和 Linux。可以使用支持多种语言的工具,比如notepad++。
是否可以在 windows 命令行中从 Azure-CLI
运行 .sh 文件。
以下是我正在尝试 运行 在本地 Azure-CLI
cosmosDB
集合创建脚本
#!/bin/bash
# Set variables for the new account, database, and collection
resourceGroupName='testgropu'
location='testlocation'
accountName='testaccount'
databaseName='testDB'
prefix='prefix.'
tenantName='testTenant'
collectionTest='.test'
originalThroughput=400
newThroughput=500
az cosmosdb collection create \
--resource-group $resourceGroupName \
--collection-name "$prefix$tenantName$collectionTest" \
--name $accountName \
--db-name $databaseName \
--partition-key-path "/'$v'/testId/'$v'"
是否可以 运行 这些命令作为来自 Azure-CLI 的脚本,如 linux . test.sh
?
实际上,您不能像 Linux . test.sh
那样 运行 bash 脚本。但是,如果您像这样在 windows 中安装 WSL,则可以 运行 命令提示符中的 bash 脚本:
bash test.sh
此外,如果您没有在 windows 中安装 WSL,则 bash
不会被识别为内部或外部命令。而且您也不能在 PowerShell 中使用 bash
命令。
注意:在windows中创建bash脚本时要注意,[=25]之间的字符不同=] 和 Linux。可以使用支持多种语言的工具,比如notepad++。