【发布时间】:2020-05-10 09:39:31
【问题描述】:
我正在使用 Azure DevOps 服务器管道 shell 脚本任务,当我将“$(Build.SourcesDirectory)”变量作为 shell 脚本参数传递时,我发现在打印变量时路径没有得到“/”。
这是我的 shell 脚本:
!/bin/bash 回声 $1
这是管道的输出:
请告诉我如何在打印变量时获取实际路径(使用“/”)?
【问题讨论】:
-
在路径上使用双引号,例如
"D:\Agent_1..."。 -
现在变成这样“D:\Agent_1\work\s”,路径中缺少“\1”。
-
在任务配置中将命令更新为
sh tfsvariable.sh "$(Build.SourcesDirectory)"并尝试。 -
将命令更新为:sh tfsvariable.sh "$(Build.SourcesDirectory)" 如下:"D:\Agent_1\work^A\s"
标签: linux shell azure-pipelines azure-devops-server-2019