如何在 curl 命令中删除名为 ${env.DateString} 的人工目录

How to delete an artifactory directory named ${env.DateString} in curl command

我正在尝试删除名为 ${env.DateString} 的人工目录,但无法正确插入。我通过使用 \ ${env.DateString} 逃脱了,但不知何故括号 {} 被遗漏了。 目录路径 http://localhost:8080/artifactory/myrepo/Docker/${env.DateString}/

curl -H "X-JFrog-Art-Api:<API-KEY>" -X DELETE http://localhost:8080/artifactory/myrepo/Docker/${env.DateString}/

错误:

{
  "errors" : [ {
    "status" : 404,
    "message" : "Could not locate artifact 'myrepo:Docker/$env.DateString' (Nothing to delete)."
  } ]
}[

${env.DateString} 中的括号在插值时丢失了

$ 和。需要 URL 编码。我们可以使用下面的API来删除文件夹 curl -H "X-JFrog-Art-Api: -X 删除 http://localhost:8080/artifactory/myrepo/Docker/%24%7Benv.DateString%7D/