运行 在 BASH 脚本下方时出现解析错误

Getting parse error while running below BASH script

在 BASH 脚本下 运行 时出现解析错误,在执行 shell 时检查其在 -d '{ 处的抛出错误-d '{ -- SC2016: Expressions don't expand in single quotes, use double quotes for that.

但是使用双引号再次没有帮助,我在 -d 处使用了一些带有单引号的类似脚本并且它运行良好。任何帮助将非常感激。补充一下,我正在 shell 从这里 https://www.shellcheck.net/

检查
#!/bin/bash
echo "Enter PAT Token"
read -r PAT

echo "Enter Organization name"
read -r OrganizationName

echo "Enter Project ID"
read -r projectId

echo "Enter Repo name"
read -r RepoName

echo "Enter Repo ID"
read -r RepoID

  "Pipeline=$(curl --write-out "%{http_code}\n" -X POST \
        -u  :"$PAT" "http://dev.azure.com/""${OrganizationName}""/""${projectId}""/_apis/build/definitions?api-version=5.0" \
        -H  "Accept: application/json" \
        -H  "Content-Type: application/json" \
        -d '{
                "name" : "TEST-PIPELINE";
                "repository" : {
                "url" : https://""${OrganizationName}""@dev.azure.com/""${OrganizationName}""/""${projectId}""/_git/""${RepoName}"";
                "defaultBranch" : "refs/heads/master";
                "id" : "'"$RepoID"'";
                "type" : "TfsGit";
                                };
        "process" : {
                "yamlFilename": "'"${RepoName}/azure-pipeline.yml"'";
                "type" : 2;
                };
                        "path": "\";
                        "type" : "build";
                }' --output PipelineOutput.txt --silent)"

        echo "Output: $(Pipeline)"

您复制的错误信息来自这一行:

"url" : https://""${OrganizationName}""@dev.azure.com/""${OrganizationName}""/""${projectId}""/_git/""${RepoName}"";

它需要一些额外的单引号,类似于您在其他地方使用的引号:

"url" : https://"'"${OrganizationName}"'"@dev.azure.com/"'"${OrganizationName}"'"/"'"${projectId}"'"/_git/"'"${RepoName}"'";