mardi 8 décembre 2020

If else condition match statements not working inside shell of jenkisnfile

I have below statement in one of the steps in Jenkinsfile

steps {

sh '''

file=/sql/common/file1.sql

echo $file

if ["$file" = "/common" ]; then

echo "changes found in common directory "

fi

''' }

for some reason shell is not working properly inside jenkinsfile, how do we compare strings in shell in Jenkinsfile, do we have any specific syntax for these ? Jenkins give error if I use == operator to compare the strings. My assumption was shell should work same way in Jenkinsfile once we declare it inside sh ''', is it not the case ?

Aucun commentaire:

Enregistrer un commentaire