I am having a steps in Jenkins pipeline to read my test passing result and fail the Stage if rate lower than 95%. Here's the code
sh ''' #!/bin/bash -xe
PASS= `cat index.txt | grep % | tr -d " " | cut -d: -f2 | cut -d% -f1`
if [[ "$PASS" -ge 95 ]]
then
exit 0
else
exit 1
fi
'''
But it constantly gives me an error
16:01:00 + cat index.txt
16:01:00 + grep %
16:01:00 + cut -d% -f1
16:01:00 + tr -d
16:01:00 + cut -d: -f2
16:01:00 + PASS= 100
16:01:00 /home/xxxx/script.sh: 100: not found
What's happened? Anyone could help? Thanks