title: if statement and calling function in if using bash
body: <p>I have written a function:</p>
  
  <pre><code>check_log(){
      if [ -f "/usr/apps/appcheck.log" ]
      then
           return 1
      else
           return 0
      fi
  }
  </code></pre>
  
  <p>Then I call this function in an "if" condition:</p>
  
  <pre><code>if [ check_log ];
  then
      ........statements....
  fi
  </code></pre>
  
  <p>Will this work? I am confused here because bash returns 0 on success and 1 on failure, but my function is returning <code>1</code> and the condition is checking for <code>1</code>/<code>0</code>, it gets <code>1</code> and it should give failures, but in my shell script the condition is passing.</p>
  
  <p>Can anyone shed light on this issue?</p>