我在 Azure0-Pipelines.yml 文件中看到 bash 的语法介绍如下:
steps:
- bash: |
which bash
echo Hello $name
displayName: Multiline Bash script
env:
name: Microsoft
我想知道“-bash:”后面的管道符号的用法是什么,我对Bash脚本很陌生,这仍然是“管道”bash命令吗?
答案 0 :(得分:1)
|
是 write a multi-line string in YAML 的多种方式之一。
答案 1 :(得分:1)
同意l0b0。 |
是 write a multi-line string in YAML 的多种方式之一。
此外,您提到的 bash 语法介绍来自此示例 yaml 代码:Bash。
您也可以使用以下经典语法。
- task: Bash@3
inputs:
targetType: 'inline'
script: |
which bash
echo Hello $name
displayName: Multiline Bash script
env:
name: Microsoft
请参阅:Bash task 了解更多详情。