Failing a Jenkins job on a condition
<p>The end goal is to search for all the files n sub-directories within a folder a on a Linux box for control m characters. If yes, do not proceed with the ANT build and fail the job. If not, proceed with the ANT build. </p>

<p>In a Jenkins job I write this script <code>outline of the script</code>:</p>

<p>Cd batch 
Grep -r "\r" > text-file \ to find ctrl m char and redirect to text file if so. </p>

<p>Then compare the content. If text file is empty build else fail the job. </p>

<p>If [-s] fail job else build. </p>

<ol>
<li><p>Is this a good approach of using Linux script to achieve? If not what's the better way?</p></li>
<li><p>How to configure a Jenkins job using execute shell and to make the shell fail and the Jenkins job fail on condition ? </p></li>
</ol>

<p>Thanks</p>