script{
println("Starting TEST")
//Declaring Variable var value in the Below Shell Block
sh"""
echo "This is Test"
var=10
echo "This is Test Value $var"
"""
//Trying to Print the var Value from above Block
sh"""
echo "This is Other Block"
echo "This is Test Value $var"
"""
//Copying the value from Shell Script Variable to Groovy Script
def scriptVar=sh(script:"$var ")
}
在上面的代码中,我尝试打印一个外壳块的值,并使用相同的值在下一个块中赋值,但在第二个块中打印值后,ECHO将只显示空白消息
暂无答案!
目前还没有任何答案,快来回答吧!