I am trying to write a simple If statement on the Execute Shell of Jenkins (1.638). I looked on  similar issue   and it still didn't work (see below the result output).I tried both [[ and [ and relevant spaces, It appears that Jenkins handles if differently than on regular bash. I even tried the then on the same line as the if with ;. Any idea ?if [[ ${BRANCH_NAME} == master ]] || [[ ${BRANCH_NAME} == master_dev ]]then    ./runUnitTests.sh ${REPOSITORY_NAME} ${BASE_BUILD_CORE} ${BRANCH_NAME} ${BUILD_NUMBER} || echo The npm may fail but the report existsfiThe result on Jenkins is[[ upgrade == master ]]/tmp/hudson11669113852432623.sh: 2: /tmp/hudson11669113852432623.sh: [[: not found[[ upgrade == master_dev ]]/tmp/hudson11669113852432623.sh: 2: /tmp/hudson11669113852432623.sh: [[: not found[core] $ /bin/sh -xe /tmp/hudson7252947297480815560.sh
Jenkins if statment
bash;jenkins
Have you considered including a bash shebang in your shell?#!/bin/bashif [[ ${BRANCH_NAME} == master ]] || [[ ${BRANCH_NAME} == master_dev ]]....That will force Jenkins to use your local bash interpreter.