我尝试使用以下语法在shell脚本中声明一个布尔变量:
variable=$false
variable=$true
Run Code Online (Sandbox Code Playgroud)
它是否正确?另外,如果我想更新该变量,我会使用相同的语法吗?最后,使用布尔变量作为正确的表达式是以下语法:
if [ $variable ]
if [ !$variable ]
Run Code Online (Sandbox Code Playgroud) 我有以下 dsl
pipeline {
agent {
label 'test'
}
parameters {
booleanParam(defaultValue: false, description: 'This is a Release build', name: 'isRelease')
}
stages {
stage('Build') {
steps {
script {
if (${params.isRelease}) {
echo("This is a release")
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这失败并出现以下错误
java.lang.NoSuchMethodError: No such DSL method '$' found among steps
Run Code Online (Sandbox Code Playgroud)
我做错了什么?我在用