I am writing a pipeline job that will call another script to execute. The Jenkinsfile and script exist in the same directory and yet the job fails to find the script to run.
I was facing a similar issue where though the shell script is present on path /var/lib/jenkins/workspace/New_commit_test/Fibonacci.sh, Jenkins build was getting failed with error message : "/tmp/jenkins6688065235543884785.sh: 3: /tmp/jenkins6688065235543884785.sh: /var/lib/jenkins/workspace/New_commit_test/Fibonacci.sh: not found"
so i changed my earlier command from : ${WORKSPACE}/Fibonacci.sh > New_commit_test.txt
to : (since i was using bash script here ) bash ${WORKSPACE}/Fibonacci.sh > New_commit_test.txt
which sorted issue here for me