使用下面的脚本打印默认shell
node {
stage('Clean'){
echo "${SHELL}"
...
}
从日志,它是/usr/local/bin/tcsh
[Pipeline] echo
/usr/local/bin/tcsh
如何将其更改为另一个shell,如/bin/csh?
尝试下面的代码,echo仍然打印"/usr/local/bin/tcsh",但是突然/bin/csh环境变量可用。
stage('Clean'){
sh '''#!/bin/csh
echo "Clean old coverage data"
echo "${SHELL}"
'''
}