简体   繁体   中英

Jenkins: How to change shell in Scripted Pipeline?

Print default shell with below script.

node {
    stage('Clean'){
        echo "${SHELL}"
...
}

From log, it's /usr/local/bin/tcsh.

[Pipeline] echo  
/usr/local/bin/tcsh

How to change it to another shell, like /bin/csh?

Tried below code, echo still prints "/usr/local/bin/tcsh", but suddenly /bin/csh environment variable is available.

stage('Clean'){
        sh '''#!/bin/csh
                echo "Clean old coverage data"
                echo "${SHELL}"
        '''
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM