What shell does Jenkins use?

后端 未结 5 1962
失恋的感觉
失恋的感觉 2020-12-09 07:05

What shell is used in Jenkins when calling the shell command? I\'m running Jenkins on a Linux machine.

5条回答
  •  时光说笑
    2020-12-09 08:04

    You can set the default shell using Jenkins > Manage Jenkins > Configure System > Shell executable.

    For jobs that use a shell different from the default, begin the Execute shell build step with a shebang, such as:

    #!/usr/bin/tcsh -e -x
    
    command1
    command2
       ...
    

    You can even use /usr/bin/env to use, say, Python:

    #!/usr/bin/env python3
    

    Beware that a space is not allowed after the #!:

    #! /usr/bin/tcsh    # Wrong
    

    This will give the error,

    java.io.IOException: Cannot run program ""
    

    I tested the above on Jenkins 1.625.3

提交回复
热议问题